源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

c#使用xamarin编写拨打电话程序

  • 时间:2022-12-29 05:58 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:c#使用xamarin编写拨打电话程序
xamarin 可以很方便的编写一个电话拨号程序,下面的代码是调用android系统的拨号功能,拨号前会给出一个提示信息。 callButton是一个用来拨号的按钮,我们使用它的点击事件来进行拨号,拨号前会有一个提示框
callButton.Click += (object sender, EventArgs e) =>
{
  // On "Call" button click, try to dial phone number. sharejs.com
  var callDialog = new AlertDialog.Builder(this);
  callDialog.SetMessage("Call " + translatedNumber + "?");
  callDialog.SetNeutralButton("Call", delegate {
      // Create intent to dial phone
      var callIntent = new Intent(Intent.ActionCall);
      callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
      StartActivity(callIntent);
    });
  callDialog.SetNegativeButton("Cancel", delegate { });
 
  // Show the alert dialog to the user and wait for response.
  callDialog.Show();
};
以上所述就是本文的全部内容了,希望大家能够喜欢。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部