public void PlaceCall(string phoneNumber) { try { var intent = new Intent(Intent.ActionCall); var uri = global::Android.Net.Uri.Parse("tel:" + CoreExtensions.ToNumericString(phoneNumber)); intent.SetData(uri); Ctx.StartActivity(intent); } catch (Exception ex) { var toast = Toast.MakeText(Ctx, "This activity is not supported", ToastLength.Long); toast.Show(); } }
public void PlaceCall(string phoneNumber) { var currentNumber = CoreExtensions.ToNumericString(phoneNumber); if (UIApplication.SharedApplication.CanOpenUrl(new NSUrl("telprompt://" + currentNumber))) { try { UIApplication.SharedApplication.OpenUrl(new NSUrl("telprompt://" + currentNumber)); } catch (Exception ex) { var m = ex.Message; } } else { NotSupportedMessage("Phone Not Enabled", "This device does not support phone calls."); } }
public void PlaceCallWithCallBack(string phoneNumber, string callBackKey) { try { this.callBackKey = callBackKey; phoneListener = new PhoneCallListener(); telephonyManager = (TelephonyManager)Ctx.GetSystemService(Context.TelephonyService); phoneListener.CallEndedEvent += PhoneCallEnded; telephonyManager.Listen(phoneListener, PhoneStateListenerFlags.CallState); var intent = new Intent(Intent.ActionCall); var uri = global::Android.Net.Uri.Parse("tel:" + CoreExtensions.ToNumericString(phoneNumber)); intent.SetData(uri); Ctx.StartActivity(intent); } catch (Exception ex) { var toast = Toast.MakeText(Xamarin.Forms.Forms.Context, "This activity is not supported", ToastLength.Long); toast.Show(); } }
public void PlaceCallWithCallBack(string phoneNumber, string callBackKey) { TelephoneManager.CallBackKey = callBackKey; var currentNumber = CoreExtensions.ToNumericString(phoneNumber); if (UIApplication.SharedApplication.CanOpenUrl(new NSUrl("telprompt://" + currentNumber))) { TelephoneManager.IsListening = true; try { UIApplication.SharedApplication.OpenUrl(new NSUrl("telprompt://" + currentNumber)); } catch (Exception ex) { var m = ex.Message; } } else { NotSupportedMessage("Phone Not Enabled", "This device does not support phone calls"); } }