简体   繁体   English

Intent.ACTION_CALL 仅在 android 9 派中不起作用

[英]Intent.ACTION_CALL not working only in android 9 pie

I have given ACTION_CALL permisiion on menifest file also but in android 9 pie it is not working..IT is also working in android 10我也给了清单文件的 ACTION_CALL 权限,但是在 android 9 馅饼中它不起作用..它也在 android 10 中工作

Intent intent = new Intent(Intent.ACTION_CALL);
                                    intent.setData(Uri.parse("tel:100"));
                                    startActivity(intent);

First make sure you have set permission in the manifest <uses-permission android:name="android.permission.CALL_PHONE"/> Then try this code首先确保您在清单中设置了权限<uses-permission android:name="android.permission.CALL_PHONE"/>然后试试这个代码

Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + xxxxxxxx));
startActivity(intent);

if you want to do it without any permission simply use ACTION_DIAL instead of ACTION_CALL to pre-populate the dialer and let the user make the call如果您想在没有任何许可的情况下进行操作,只需使用ACTION_DIAL而不是ACTION_CALL来预填充拨号器并让用户拨打电话

Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:xxxxxxx"));
startActivity(intent);

Add permission into Manifest File:-在清单文件中添加权限:-

<uses-permission android:name="android.permission.CALL_PHONE" />

And Intent:和意图:

  Intent in = new Intent(Intent.ACTION_DIAL);
            in.setData(Uri.parse("tel:" + your text));
            startActivity(in);

ADD Permission in the manifest file在清单文件中添加权限

<uses-permission android:name="android.permission.CALL_PHONE" />

Add Intent添加意图

int number = 123 123 123
Intent i = new Intent(Intent.ACTION_DIAL);
startActivity(i.setData(Uri.parse("tel:" + number));)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM