public async void OnInitialized()
        {
            try {
                var client = new HttpClient();
                var token  = await client.GetStringAsync(httpServer + "/Client/Token?clientName=" + clientName);

                _device = Twilio.CreateDevice(token, null);

                var intent        = new Intent(this.ApplicationContext, typeof(MainActivity));
                var pendingIntent = PendingIntent.GetActivity(this.ApplicationContext, 0, intent, PendingIntentFlags.UpdateCurrent);

                _device.SetIncomingIntent(pendingIntent);
            } catch (Exception ex) {
                Log.Info(TAG, "Error: " + ex.Message);
            }
        }
Esempio n. 2
0
        public async void OnInitialized()
        {
            Console.WriteLine("Twilio SDK is ready.");

            try {
                var client = new HttpClient();
                var token  = await client.GetStringAsync($"*** YOUR AUTH TOKEN URL ***");

                Device = Twilio.CreateDevice(token, null);

                var intent        = new Intent(context, typeof(MainActivity));
                var pendingIntent = PendingIntent.GetActivity(context, 0, intent, PendingIntentFlags.UpdateCurrent);

                Device.SetIncomingIntent(pendingIntent);

                Device.SetDeviceListener(this);
            } catch (Exception ex) {
                Console.WriteLine("Error: " + ex.Message);
            }
        }