Dial a USSD code

by sabdart » Fri, 23 Jan 2009 16:44:39 GMT

Sponsored Links

When I dial a divert number directly from the handset it works.
For example: **004*+668190099# sets up my call forwarding to the
number +668190099

However, when I try to do the same thing from within an application I
get a problem. The number displayed in the dialer is missing the
ending #.

startActivity(new Intent("android.intent.action.DIAL",

displays **004*+668190099 in the dialer.

The log shows:
I/ActivityManager(   56): Starting activity: Intent
{ action=android.intent.action.DIAL data=tel:**004*+668190099# comp=
{com.android.contacts/com.android.contacts.DialtactsActivity} }

Is this a bug or is there some other reason it wont let me dial a ussd


Dial a USSD code

by sabdart » Thu, 29 Jan 2009 15:41:16 GMT

 Not a bug and it is in the documentation ( http://code.google.com/ 
I should have been escaping the # symbol with %23

String encodedHash = Uri.encode("#");

startActivity(new Intent("android.intent.action.DIAL",
     Uri.parse("tel:**004*+668190099" + encodedHash)));

Note to self: RTFM

Sponsored Links

Dial a USSD code

by droi...@gmail.com » Tue, 03 Mar 2009 07:29:39 GMT

 Does the Android API provide a way to catch the USSD response after
the dial?



Dial a USSD code

by Ray » Tue, 10 Mar 2009 18:44:35 GMT

 I expected to see the response by using startActivityForResult and
onActivityResult(int requestCode, int resultCode, Intent data)

But that didn't work for me and I've run out of ideas.



Dial a USSD code

by Ray » Thu, 12 Mar 2009 16:07:31 GMT

 saying that... I have been testing on a network other than Tmobile...
If anyone reading this in the US on Tmobile tries this, please post
the results. You will need to change the USSD code to one that is
valid for Tmobile, one that returns the handset mobile number would be
a good choice.

Also enable calling in the manifest and create a TextView called

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

        String encodedHash = Uri.encode("#");

        view = (TextView) findViewById(R.id.sometext);
        call("*121" + encodedHash);

    protected void call(String phoneNumber) {
        startActivityForResult(new Intent("android.intent.action.CALL",
                       Uri.parse("tel:" + phoneNumber)), 1);

    protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
        view.setText("USSD: " + requestCode + " " + resultCode + " " +


Other Threads

1. How to find the VERSION of the Android source code?

Hi All,

Is there any command/README FILE to find the version of paticular
Android Source Code?

How do I find out the version of source code?

Thanks & Regards,


2. Locked Phones for development.

Hi All,

According to rumors there are 18 Android phones in the work for 2009.
These are probably locked to a certain carrier.  If I have one of
these LOCKED phones can I debug apps on it?



3. Getting a reference to the View corresponding to the id passed to setContentView()

4. Early media over GSM (similar to SIP 183, or ISDN alerting phase)

5. AutoCompleteTextView and AdapterView.onItemClickListener with onscreen keyboard not working

6. Maximum SD Card size?

7. Android 1.5 (Cupcake) permissions on Location/GPS settings