I'm trying to implement ConnectionService. For this I need to register a phone account on TelecomService, so the device will know it can use my app for making phone calls.
When I try to register a phone account I get a SecurityException: Package com.xxx.xxx does not belong to 10145.
What am I missing? Here is the code to register a phone account. (I have added the permission to the manifest etc)
PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle(new ComponentName("com.mypackage", "com.mypackage.MyConnectionService", "my_phoneHandleId");
PhoneAccount.Builder builder = PhoneAccount.builder(phoneAccountHandle, "Custom label");
builder.setCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT | PhoneAccount.CAPABILITY_CONNECTION_MANAGER);
builder.addSupportedUriScheme("my_scheme");
builder.setAddress(Uri.parse("my_scheme://" + "customNumber"));
PhoneAccount phoneAccount = builder.build();
telecomService.registerPhoneAccount(phoneAccount);