Exemple #1
0
        /*
         * Initialize the Twilio Conversations SDK
         */
        void initializeTwilioSdk()
        {
            TwilioConversations.SetLogLevel(TwilioConversations.LogLevel.Debug);

            if (!TwilioConversations.IsInitialized)
            {
                TwilioConversations.Initialize(ApplicationContext, new TwilioConversations.InitListener {
                    InitHandler = () => {
                        /*
                         * Now that the SDK is initialized we create a ConversationsClient and register for incoming calls.
                         */
                        // The TwilioAccessManager manages the lifetime of the access token and notifies the client of token expirations.
                        accessManager       = TwilioAccessManagerFactory.CreateAccessManager(accessToken, accessManagerListener());
                        conversationsClient = TwilioConversations.CreateConversationsClient(accessManager, conversationsClientListener());

                        // Specify the audio output to use for this conversation client
                        conversationsClient.AudioOutput = AudioOutput.Speakerphone;

                        // Initialize the camera capturer and start the camera preview
                        cameraCapturer = CameraCapturerFactory.CreateCameraCapturer(this, CameraCapturerCameraSource.CameraSourceFrontCamera, previewFrameLayout, capturerErrorListener());
                        startPreview();

                        // Register to receive incoming invites
                        conversationsClient.Listen();
                    },
                    ErrorHandler = err => {
                        Toast.MakeText(this,
                                       "Failed to initialize the Twilio Conversations SDK",
                                       ToastLength.Long).Show();
                    }
                });
            }
        }
Exemple #2
0
 public void OnIncomingInviteCancelled(IConversationsClient conversationsClient, IIncomingInvite incomingInvite)
 {
     InviteCancelledHandler?.Invoke(conversationsClient, incomingInvite);
 }
Exemple #3
0
 public void OnStopListeningForInvites(IConversationsClient conversationsClient)
 {
     StopListeningForInvitesHandler?.Invoke(conversationsClient);
 }
Exemple #4
0
 public void OnFailedToStartListening(IConversationsClient conversationsClient, TwilioConversationsException conversationException)
 {
     FailedToStartHandler?.Invoke(conversationsClient, conversationException);
 }