Intent.ACTION_调用仅在android 9中不起作用
我也给了menifest文件上的ACTION_CALL权限,但在android 9 pie中它不起作用。它在android 10中也起作用Intent.ACTION_调用仅在android 9中不起作用,android,android-intent,Android,Android Intent,我也给了menifest文件上的ACTION_CALL权限,但在android 9 pie中它不起作用。它在android 10中也起作用 Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:100")); startActivity(intent);
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:100"));
startActivity(intent);
首先确保您在清单中设置了权限
然后试试这个代码
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + xxxxxxxx));
startActivity(intent);
如果您想在没有任何许可的情况下执行此操作,只需使用ACTION\u DIAL
而不是ACTION\u CALL
来预填充拨号程序并让用户进行呼叫
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:xxxxxxx"));
startActivity(intent);
在清单文件中添加权限
<uses-permission android:name="android.permission.CALL_PHONE" />
logcat怎么说?
int number = 123 123 123
Intent i = new Intent(Intent.ACTION_DIAL);
startActivity(i.setData(Uri.parse("tel:" + number));)