In my android app, I am sending USSD
codes (#144#73#
) using below Intent
:
String baseUssd = Uri.encode("#") + "144" + Uri.encode("#");
StringBuilder builder = new StringBuilder();
builder.append(baseUssd);
builder.append("73");
builder.append(Uri.encode("#"));
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + builder.toString()));
It's working well.
What I want now is to send this code :
#144#73MA#
I run this using the dial pad, following the Operator USSD menu, that worked.
But if I try to do this programmatically using the above Intent
that didn't work.
I know that alphabetic characters can't be used when typing code with the Dial Pad, but I though that It can be possible programmatically !!
Any Idea please !
Edit
When I try to send this programmatically : #144#73MA#
I noticed that the Dialer application changes the alphabetic characters to their corresponding digit in the dial pad. Meaning that the dialer transform this : #144#73MA#
to this #144#73
62
#
: why ?
Because :
- the
M
matches the digit6
- the
A
matches the digit2
I will try to answer only the why part.
Intent.ACTION_CALL
is handled byOutgoingCallBroadcaster
class. If you look atprocessIntent()
method, there is this piece of code (lines 438~448 as of this writing):There
PhoneNumberUtils.convertKeypadLettersToDigits()
converts the letters into the equivalent numeric digits:Hope this helps.