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. ADC 2 and Android Market Place Application Error


You don't have to refactor your Java code to a new namespace. Instead,
you can try changing the package attribute within the manifest and
make sure the classnames are fully qualified.



2. GK : Ho to Skip DroidDo

Hi all,
    Am  compiling the Android Platform source code. It took around 4
hrs to compile the package.
I Used $ make -j4 sdk

Can any one suggess how to minimize the time and I dont want for
compile the javadoc everytime
How to skip this DroidDoc. ?
Help me out.

Thanks in Advance.


3. UI Testing in Android Frameworks

4. How to load a file from assets directory in native code?

5. Android 2.0 Review

6. access Java code from WebKit plugin

7. Figuring out android.telephony.cdma