简体   繁体   中英

MMI Code from dialer app making call instead request

Context :

I am developing an android dialer app ( Phone app ) Via which app dial pad, app call management is done.

This is my dial pad :

拨号器

You see *123# is typed

The Sim Selection :

模拟选择

Sim selection bottom dialog

What code is running in bottom dialog :

Log.d("CALL", "to :" + dialNumber + ".. \n");
intent.setData(Uri.parse("tel:"+dialNumber));
intent.putExtra("com.android.phone.force.slot", true);

Log.d("CALL", "ACCOUNTS :" + phoneAccountHandleList.size() + ".. \n");

if (sim == 0)
{
    intent.putExtra("com.android.phone.extra.slot", 0);
    if (phoneAccountHandleList != null && phoneAccountHandleList.size() > 0)
    {
        intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", phoneAccountHandleList.get(0));
    }
 }
 else
 {
    intent.putExtra("com.android.phone.extra.slot", 1);
    if (phoneAccountHandleList != null && phoneAccountHandleList.size() > 1)
    {
        intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", phoneAccountHandleList.get(1));
    }

 }

 context.startActivity(intent);

InCallService manage call :

Within the InCallService i manage calls. If a call is added then i starts CallActivity from below code

callType = CallType.CALL_OUT;

Call.Details details = call.getDetails();
String CallingNumber = details.getHandle().getSchemeSpecificPart();
CallActivity.start(this, CallingNumber, callType, false);

My CallActivity :

通话活动

What are my problems :

  1. You can see above i had dialed *123# from dialer, But it is just calling *123
  2. It must not have started the Call Activity, Instead it must have requested it as MMI CODE

Any help or guidance is appreciated, Thank you in advance.

I think you can do:

String encode_hash = Uri.encode("#");
intent.setData(Uri.parse("tel:"+dialNumber + encode_hash));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM