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. OutputStream on assets file

What happens if I open an OutputStream on a file in the assets folder?
Can I write over it? What happens to the file size if I write less
data than the original size?


2. UPDATE & SOLD : WTTuker Guling : motodroid froyo dengan droid yg msh perawan

waduh? udh laku bro ?? kyaknya droid x nih next..he he

permisi rekan2 dgn ini saya beritahukan moto Droid saya sudah laku.

Sekarang nyari yg perawan yg siap dijebol..... klo ada japri ye...

"Indonesian Android Community [id-android]"

3. Heads up, hold off updating to Java 1.6.0_21 on your dev machine

4. Even with Min SDK version, building app against 2.2 breaks 1.5?

5. Nexus One for developers

6. UPDATE & SOLD : WTTuker Guling : motodroid froyo dengan droid yg msh perawan

7. Android virus protectio