Question

I'm trying to create an android app to simply dial a ussd code. I've searched all over and tried everything I could but no luck. Is there anyone that can help me? and btw I'm very new to this and I have no idea where to start. Any help would be appreciated.

Was it helpful?

Solution 2

you can just dial using call intent. use the ussd number as the input there. For example

Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("*123#")); 
        startActivity(callIntent);

OTHER TIPS

Sometimes when using (*123#) the hash sign doesn't show up..got this code from a fellow user here and it works perfectly with the code above:

String encodedHash = Uri.encode("#");
            String ussd = "*" + "123" + encodedHash;
            startActivityForResult(new Intent("android.intent.action.CALL",
            Uri.parse("tel:" + ussd)), 1);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top