2

I am trying to use Twilio for video calling application, one end is web and another end is android. Using Firebase to trigger push notification from web to android. I need to convert the push notification as Incoming call screen in android application, to do that I have used ConnectionService which is documented as available from API 23. I have registered PhoneAccount as below:

TelecomManager tm = (TelecomManager) getSystemService(Context.TELECOM_SERVICE); 
PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle(
                new ComponentName(this.getApplicationContext(), MyConnectionService.class),
                "AppName");
PhoneAccount phoneAccount = PhoneAccount.builder(phoneAccountHandle, "AppName")
    .setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER).build();
    tm.registerPhoneAccount(phoneAccount);

I registered PhoneAccount for first time with

PhoneAccount phoneAccount = PhoneAccount.builder(phoneAccountHandle, "AppName")
  .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED).build();

which will work only on API 26, Later I changed it to

PhoneAccount phoneAccount = PhoneAccount.builder(phoneAccountHandle, "AppName")
.setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER).build(); 

Later one worked as expected in API 26 but on lower versions, it gave an exception

java.lang.SecurityException: This PhoneAccountHandle is not registered for this user!

can anybody help with this issue?

  • did you find any solution? i am having the same issue, it was working for some time and then again give the same error – SoftSan Mar 30 '21 at 17:02
  • Same issue here.....I don't find solutions anywhere. It is working with some phones, I have that weird message in others. Even after theorically "activating" the account by doing Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.server.telecom","com.android.server.telecom.settings.EnableAccountPreferenceActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent); – zapotec Oct 08 '21 at 13:04

0 Answers0