Open Aayushi-Mashru opened 1 year ago
const granted = await PermissionsAndroid.request(
"android.permission.READ_PHONE_NUMBERS"
);
const options = {
ios: {
appName: "My app name",
},
android: {
alertTitle: "Permissions required",
alertDescription: "This application needs to access your phone accounts",
cancelButton: "Cancel",
okButton: "ok",
selfManaged: true,
additionalPermissions: [
"android.permission.READ_PHONE_NUMBERS",
"android.permission.READ_PHONE_STATE",
],
},
};
RNCallKeep.setup(options)
RNCallKeep.displayIncomingCall('uuidv4', "10086", "Caller Name");
Please try this one
Same issue for me. RNCallKeep was working perfectly. I changed the mode to Self Managed with the intend of avoiding my calls from reaching the Call Logs of the phone. The first time it worked fine & I thought I was set. But next time, I started the app it started crashing with this same issue. Error, cannot change a self-managed phone account ComponentInfo{app-package-id/io.wazo.callkeep.VoiceConnectionService}, ***, UserHandle{0} to other kinds of phone account Tried reinstalling the app from start & similar behaviour. Worked fine for a couple of times & after that started crashing.
,@ibmmt 's suggestion above did not help. Any fix for this would be helpful ? Alternatively, if there's way to avoid our calls from reaching the Call Logs of the phone, that will be great for my use case too.
Thanks !
Having this issue on some our clients with ViVo phone. Any insights?
Hello, We applied some changes to unregister the PhoneAccount by calling unregisterPhoneAccount method before trying to create or register it, and it fixed the issue. Here are the changes we have made.
File: RNCallKeepModule.java
[Change 1]
private void registerPhoneAccount(Context appContext) {
if (!isConnectionServiceAvailable()) {
Log.w(TAG, "[RNCallKeepModule] registerPhoneAccount ignored due to no ConnectionService");
return;
}
this.initializeTelecomManager();
Context context = this.getAppContext();
if (context == null) {
Log.w(TAG, "[RNCallKeepModule][registerPhoneAccount] no react context found.");
return;
}
String appName = this.getApplicationName(context);
PhoneAccount.Builder builder = new PhoneAccount.Builder(handle, appName);
if (isSelfManaged()) {
builder.setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED);
}
else {
builder.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER);
}
if (_settings != null && _settings.hasKey("imageName")) {
int identifier = appContext.getResources().getIdentifier(_settings.getString("imageName"), "drawable", appContext.getPackageName());
Icon icon = Icon.createWithResource(appContext, identifier);
builder.setIcon(icon);
}
PhoneAccount account = builder.build();
telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//Custom change start
telecomManager.unregisterPhoneAccount(handle);
//Custom change end
telecomManager.registerPhoneAccount(account);
}
[Change 2]
public void initializeTelecomManager() {
Context context = this.getAppContext();
if (context == null) {
Log.w(TAG, "[RNCallKeepModule][initializeTelecomManager] no react context found.");
return;
}
ComponentName cName = new ComponentName(context, VoiceConnectionService.class);
String appName = this.getApplicationName(context);
//Custom change start
if (handle != null && telecomManager != null) {
telecomManager.unregisterPhoneAccount(handle);
}
//Custom change end
handle = new PhoneAccountHandle(cName, appName);
telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
}
Hope this helps.
Hello, We applied some changes to unregister the PhoneAccount by calling unregisterPhoneAccount method before trying to create or register it, and it fixed the issue. Here are the changes we have made.
File: RNCallKeepModule.java
[Change 1]
private void registerPhoneAccount(Context appContext) { if (!isConnectionServiceAvailable()) { Log.w(TAG, "[RNCallKeepModule] registerPhoneAccount ignored due to no ConnectionService"); return; } this.initializeTelecomManager(); Context context = this.getAppContext(); if (context == null) { Log.w(TAG, "[RNCallKeepModule][registerPhoneAccount] no react context found."); return; } String appName = this.getApplicationName(context); PhoneAccount.Builder builder = new PhoneAccount.Builder(handle, appName); if (isSelfManaged()) { builder.setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED); } else { builder.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER); } if (_settings != null && _settings.hasKey("imageName")) { int identifier = appContext.getResources().getIdentifier(_settings.getString("imageName"), "drawable", appContext.getPackageName()); Icon icon = Icon.createWithResource(appContext, identifier); builder.setIcon(icon); } PhoneAccount account = builder.build(); telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); //Custom change start telecomManager.unregisterPhoneAccount(handle); //Custom change end telecomManager.registerPhoneAccount(account); }
[Change 2]
public void initializeTelecomManager() { Context context = this.getAppContext(); if (context == null) { Log.w(TAG, "[RNCallKeepModule][initializeTelecomManager] no react context found."); return; } ComponentName cName = new ComponentName(context, VoiceConnectionService.class); String appName = this.getApplicationName(context); //Custom change start if (handle != null && telecomManager != null) { telecomManager.unregisterPhoneAccount(handle); } //Custom change end handle = new PhoneAccountHandle(cName, appName); telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); }
Hope this helps.
Its working on me thanks ! 😄 👍
Bug report
[*] I've checked the example to reproduce the issue.
Reproduced on:
Description
App is crashing during setup when trying to registerPhoneAccount in RNCallKeepModule for selfManaged true mode.
Steps to Reproduce
Setup RNCallKeep with selfManaged true.
Versions
Logs