简体   繁体   English

应用选择器未在Android 6.0中显示Intent.ACTION_CALL的电话应用

[英]App chooser is not displaying Phone app for Intent.ACTION_CALL in Android 6.0

In my android app i am trying to call on phone numbers without going to dialer. 在我的Android应用程序中,我尝试不拨打拨号器就拨打电话号码。

So i am using following code to achieve so: 所以我正在使用以下代码来实现:

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + phone_number));
startActivity(Intent.createChooser(callIntent, "Call..."));

I have also added the permission in manifest 我还在清单中添加了权限

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

This code works fine till Android 5.1 which shows all the calling Apps installed in the App chooser but on Android 6.0 onwards it shows either a blank chooser or the App chooser with Skype on it if installed. 这段代码在Android 5.1之前可以正常工作,后者显示了所有安装在应用选择器中的调用应用,但在Android 6.0及更高版本上,它显示了空白选择器或安装了Skype的应用选择器。

You need to ask for that permission on Run time from api 23 on. 您需要从api 23开始在运行时请求该权限。 Here's the documentation: https://developer.android.com/training/permissions/requesting.html 这是文档: https : //developer.android.com/training/permissions/requesting.html

在运行时请求权限CALL_PHONE,它将起作用。

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

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