private const string clientName = "xamarin";                   //alice

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            Twilio.Initialize(this.ApplicationContext, this);

            // Get our button from the layout resource,
            // and attach an event to it
            Button   call          = FindViewById <Button> (Resource.Id.callButton);
            EditText phoneEditText = FindViewById <EditText> (Resource.Id.phoneNumberEditText);

            call.Click += delegate {
                var parameters = new Dictionary <string, string> ()
                {
                    { "from", myPhoneNum },
                    { "to", phoneEditText.Text }
                };

                _connection = _device.Connect(parameters, null);
            };

            Button anyKey = FindViewById <Button> (Resource.Id.anyKeyButton);

            anyKey.Click += delegate {
                if (_connection != null && _connection.State == ConnectionState.Connected)
                {
                    _connection.SendDigits("1");
                }
            };

            Button hangup = FindViewById <Button> (Resource.Id.hangupButton);

            hangup.Click += delegate {
                _connection.Disconnect();
            };
        }
예제 #2
0
 public MonkeyPhone(Context context)
 {
     this.context = context;
     Twilio.Initialize(context, this);
 }