0

System managed connection - place inbound call process

first i initialzed the telecom manager

private void initializeTelecomManager(){
        Context context=this.getAppContext();
        ComponentName cName = new ComponentName(context, VoiceConnectionService.class);
        String appName=this.getApplicationName(context);
        handle = new PhoneAccountHandle(cName, appName);
        telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
    }

then register the phone account handler

     this.initializeTelecomManager();
        String appName = this.getApplicationName(this.getAppContext());
        PhoneAccount.Builder builder = new PhoneAccount.Builder(handle, appName)
                .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER);

        PhoneAccount account = builder.build();

        telephonyManager = (TelephonyManager) this.getAppContext().getSystemService(Context.TELEPHONY_SERVICE);

        telecomManager.registerPhoneAccount(account);

but whenever i tried to mock add incoming call it says -: Phone Account Handle is not enabled for this user

        Bundle extras = new Bundle();
        Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, "1234567890", null);

        extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, uri);
        extras.putString("EXTRA_CALLER_NAME", callerName);
        extras.putString("EXTRA_CALL_UUID", uuid);

        telecomManager.addNewIncomingCall(handle, extras);
  • Does this answer your question? [How to fix java.lang.SecurityException: This PhoneAccountHandle is not enabled for this user?](https://stackoverflow.com/questions/65794085/how-to-fix-java-lang-securityexception-this-phoneaccounthandle-is-not-enabled-f) – Petra Minaler May 24 '23 at 08:17
  • No, tried it already it only take to white screen where the device doesn't show anything – Shashwat Samadhiya May 25 '23 at 11:06

0 Answers0