【问题标题】:How can I avoid having my hybrid app showing up on the Android dialer?如何避免我的混合应用出现在 Android 拨号器上?
【发布时间】:2020-05-13 17:40:24
【问题描述】:

我为 Android 和 iOS 构建了一个呼叫应用程序,我正在使用 Callkit 作为呼叫界面。

这是一款使用 Ionic 和 Cordova 开发的混合应用。

我的问题是,在某些 android 设备(不是全部)中,当用户想通过 SIM 卡呼叫某人时,我的应用程序会显示(作为一个选项)。而且我不希望这种情况发生。

我尝试通过手机设置修复它,我可以完成它,但是一旦我进入我的应用程序,它就会再次发生。

这是我正在使用的插件的分支:

https://github.com/Qvadis/cordova-plugin-callkit

我做了一些研究,发现可能与这段代码有关:

if(android.os.Build.VERSION.SDK_INT >= 23) {
    phoneAccount = new PhoneAccount.Builder(handle, appName)
               .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
               .build();
    tm.registerPhoneAccount(phoneAccount);
 }

但是,如果我评论它,callkit UI 不会显示。

任何人都可以在这里解释一下吗?

谢谢你, 博尔哈。

【问题讨论】:

    标签: android cordova ionic-framework callkit sim-card


    【解决方案1】:

    我找到了解决办法:

    显然是 CAPABILITY_CALL_PROVIDER,它正在注册我的应用程序,能够从电话堆栈中调用。

    让我复制我从 google 的 PhoneAccount 类中找到的代码:

    public class PhoneAccount implements Parcelable {
    /**
     * Flag indicating that this {@code PhoneAccount} can act as a connection manager for
     * other connections. The {@link ConnectionService} associated with this {@code PhoneAccount}
     * will be allowed to manage phone calls including using its own proprietary phone-call
     * implementation (like VoIP calling) to make calls instead of the telephony stack.
     * <p>
     * When a user opts to place a call using the SIM-based telephony stack, the
     * {@link ConnectionService} associated with this {@code PhoneAccount} will be attempted first
     * if the user has explicitly selected it to be used as the default connection manager.
     * <p>
     * See {@link #getCapabilities}
     */
    public static final int CAPABILITY_CONNECTION_MANAGER = 0x1;
    /**
     * Flag indicating that this {@code PhoneAccount} can make phone calls in place of
     * traditional SIM-based telephony calls. This account will be treated as a distinct method
     * for placing calls alongside the traditional SIM-based telephony stack. This flag is
     * distinct from {@link #CAPABILITY_CONNECTION_MANAGER} in that it is not allowed to manage
     * calls from or use the built-in telephony stack to place its calls.
     * <p>
     * See {@link #getCapabilities}
     * <p>
     * {@hide}
     */
    public static final int CAPABILITY_CALL_PROVIDER = 0x2;
    

    我使用的是 CAPABILITY_CONNECTION_MANAGER,而不是 CAPABILITY_CALL_PROVIDER。行为相同,但我的应用不再显示为电话堆栈中的有效呼叫应用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-15
      • 1970-01-01
      • 2016-08-15
      • 2014-04-14
      • 2016-07-16
      • 1970-01-01
      • 2021-06-23
      • 2013-01-27
      相关资源
      最近更新 更多