android打电话---android.intent.action.CALL
来源:互联网 发布:nginx tomcat 502错误 编辑:程序博客网 时间:2024/05/17 01:49
拨打电话的关键有两点,
首先,要在AndroidManifest中添加uses-permission,并声明Android:name="Android.permission.CALL_PHONE"使用权限,否则当点击拨打按钮时会发生运行错误。
<uses-permission android:name="android.permission.CALL_PHONE">
其次,通过自定义的Intent对象,带入"ACTION_CALL"这个关键,以及通过Uri.parse()的方法将用户输入的电话号码(Data)带入,最后以startActivity()方法(将自定义的Intent传入,即可完成通过程序直接拨打电话的工作。)
主程序中代码段如下:
Intent myInt=new Intent("android.intent.action.CALL",Uri.parse("tel:"+strInputPhoneNumber));
startActivity(myInt);
也可以使用"android.Action.Dialer"的方式,调用虚拟键盘来拨打电话,只需要创建拨打电话的intent,并启动就行
Intent myIntentDial = new Intent("android.intent.action.DIAL");
/*在startActivity()方法中带入自定义的Intent对象以执行拨打电话的工作*/
startActivity(myIntentDial);,就可以了。
/*在startActivity()方法中带入自定义的Intent对象以执行拨打电话的工作*/
startActivity(myIntentDial);,就可以了。
推荐使用虚拟键盘----直接进入ANDROID系统打电话 程序
其中我们需要注意电话号码的格式1.自定义方法检测字符串2.使用android:phineNumber="true控制输入
0 0
- android打电话---android.intent.action.CALL
- Android拨打电话Intent.ACTION.CALL
- Android拨打电话(Intent.ACTION.CALL)
- 安卓中android.intent.action.CALL与android.intent.action.DIAL的区别
- Android调用打电话(Call Phone)
- gsm call命令向Android模拟器打电话
- gsm call命令向Android模拟器打电话
- Android Intent Action 大全
- android.intent.action大全
- android.intent.action大全
- android.intent.action大全
- Android Intent Action大全
- android.intent.action.PRE_BOOT_COMPLETED
- Android Intent Action大全
- android.intent.action大全
- Android Intent Action 大全
- Android Intent Action 大全
- Android Intent Action 大全
- 为unity添加自定义菜单
- LVS负载均衡学习
- JSch - Java实现的SFTP(文件下载详解篇)
- JSP过滤器防止Xss漏洞
- SharePoint 2013 APP 安全示例 (二)获取用户信息
- android打电话---android.intent.action.CALL
- poj1125--floyd算法
- win8软件安装位置在哪?windows8软件安装位置修改教程
- iPhone开发【十七】多线程开发之NSOperation&NSOperationQueue——异步下载图片
- Linux Shell常用命令总结
- ALSA 内核提供给用户空间的接口
- Dump Linux Memory
- Java 中HashSet的部分解释
- liunx上部署多个tomcat