When I dial a directly from the handset it works. For example: *123# gets balance of number.
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 #. I need it in my application i want my app should support all the USSD codes.
Is there any way to dial ussd codes with in the application?
Unstructured Supplementary Service Data (USSD)—sometimes known as "quick codes" or "feature codes"—is an extra-UI protocol, which allows people to access hidden features.
Android code: *#*#4636#*#* This code will open up a menu that shows information about your phone's data usages.
To do that, dial *3001#12345#* and call the number. Here, you can view information about your SIM card and your phone. Learn about other USSD codes.
Examples of USSD commands are *225# and #225# — the respective balance inquiries for AT&T and T-Mobile users. On mobile devices, the commands are typed and sent within the standard interface for calls.
I'm not completely sure but I think USSD is not yet supported on android, however you can try this workaround:
String encodedHash = Uri.encode("#");
String ussd = "*" + encodedHash + "123" + encodedHash;
startActivityForResult(new Intent("android.intent.action.CALL",
Uri.parse("tel:" + ussd)), 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With