Dial a USSD code

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


Sponsored Links
 Hi,

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 #.

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

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
code?

Cheers
Ray
--~--~---------~--~----~------------~-------~--~----~



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/ 
android/reference/android/net/Uri.html)
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?

thanks



--~--~---------~--~----~------------~-------~--~----~



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.

Ray




--~--~---------~--~----~------------~-------~--~----~



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
sometext.

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        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);
    }

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






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Periodically updating GUI

I want to display text clock that would update every second. What is
the best way to do this?
Is it possible to use AsyncTask somehow?
--~--~---------~--~----~------------~-------~--~----~

2. Enabling bluetooth on Android

Can any help me to enable bluetooth on android platofrm (steps to
configuration, patched,test program ..etc)?

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Good practise

4. SDK 1.5 r3 - API Demo broken?

5. About the mixture of 2D and 3D drawing

6. Decode base64 wav

7. Using SQLLite with Android