我为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用户界面。
任何人都可以在这里阐明一些信息吗?
谢谢,Borja。
我找到了解决方法:
显然是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。行为相同,但是我的应用程序不再显示为电话堆栈中的有效呼叫应用程序。