android - 如何将我的应用程序添加到 Android 默认拨号器选择中?

标签 android android-intent phone-call

我的问题是如何将我的应用程序添加到 android 默认拨号器选择中,更具体地说,而不使用 android.intent.action.CALL_PRIVILEGED?

现在我正在使用下面的代码,效果很好:

<intent-filter>
    <action android:name="android.intent.action.CALL_PRIVILEGED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="tel" />
</intent-filter>

但是 Google 最近发布了:http://productforums.google.com/forum/#!topic/mobile/wXqnbynsL8Y

并将其邮寄给使用 Intent android.intent.action.CALL_PRIVILEGED 的程序:

Issue: Users of your application may not be able to make emergency phone calls through the system phone dialer if they've elected to have your application route calls. As noted in the documentation, applications that listen for the CALL_PRIVILEGED Intent action will intercept emergency service calls from the system, but may not be able to route them properly. Please note that CALL_PRIVILEGED is a restricted API, not intended for use within third party applications that cannot route emergency calls properly.

Solution:
• Remove CALL_PRIVILEGED from Intent filters in Java code and AndroidManifest.xml. • Update your Google Play listing description to include a statement that using your app as a default dialer may interfere with dialing 911 emergency services.

最简单的解决方案是删除,但应用程序将使用功能。但是是否有另一种方法可以将应用程序添加到默认拨号器选择中?但没有 CALL_PRIVILEGED Intent ?

提前致谢

default dialer selection

只是默认拨号器选择的示例

编辑:

我使用的其他 Intent :

 <intent-filter>
            <action android:name="android.intent.action.CALL_BUTTON" />
                <category android:name="android.intent.category.DEFAULT" />
                 <data android:scheme="tel"/>
            </intent-filter>

             <intent-filter>
                <action android:name="android.intent.action.DIAL" />
                <category android:name="android.intent.category.DEFAULT" />
                 <data android:scheme="tel"/>
            </intent-filter>

最佳答案

         <intent-filter>
            <action android:name="android.intent.action.CALL_PRIVILEGED" />                
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="tel" />
         </intent-filter>

更重要的是, Intent 过滤器中需要特权调用操作,数据为 uri 的“tel”。 另外,下面的权限标签还需要允许调用电话。 您的代码中缺少类别启动器。

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

关于android - 如何将我的应用程序添加到 Android 默认拨号器选择中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16587026/

相关文章:

android - 三星设备自动设置共享 Intent 的默认应用程序

android - 使用 Android Intent 打开 PDF 文件

android - 跟踪电话通话时间

Android 在通话期间播放音频文件

android - 三星应用商店中的 Google Play 应用

Java - 实现动态大小对象数组的最佳方式

java - requestPermissions() 什么都不做

android - 如何以 dpi 获取屏幕宽度?

android - 是否可以使用私有(private) Intent 而不是全局 Intent ?

由于手机号码无效,iOS Swift 调用崩溃