[英]making phone call in android
Making a Call through android device via phone and the code does not seems to work 通过电话通过android设备拨打电话,该代码似乎无效
I am call this function 我称这个功能
private void call() {
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("912345678"));
startActivity(callIntent);
} catch (ActivityNotFoundException activityException) {
Log.e("dialing-example", "Call failed", activityException);
}
}
also I have given the permission 我也同意了
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
What am I doing wrong any one can guide me? 我做错了什么人可以指导我?
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
startActivity(intent);
make permission in manifest file: 在清单文件中进行许可:
<uses-permission android:name="android.permission.CALL_PHONE"/>
callIntent.setData(Uri.parse("tel:91234566"));
如果您未指定URI的方案(在这种情况下为tel:
,则不会将其识别为电话号码,因此不会发生所需的操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.