Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Intent.ACTION_调用仅在android 9中不起作用_Android_Android Intent - Fatal编程技术网

Intent.ACTION_调用仅在android 9中不起作用

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);

我也给了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, 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));)