0

My app currently does not produce the final "#" at the end of AT&T's USSD code for checking data use (Which is supposed to be *3282#)

Here is my code:

public void callATT(View view){
        Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "*3282#"));
        startActivity(intent);
    }

Everytime it calls it just calls "*3282"

Please help me,

Thanks in advance

-Tucker

tgs266
  • 188
  • 1
  • 3
  • 13

4 Answers4

1

Try this, I did not test it, but should work.

Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Uri.encode("*3282#")));
startActivity(intent);
benjosantony
  • 537
  • 4
  • 13
1
    public Uri USSDToCallableUri(String ussd) {
    String uriString = "";

    if(!ussd.startsWith("tel:"))
        uriString += "tel:";

            for(char c : ussd.toCharArray()) {

                if(c == '#')
                    uriString += Uri.encode("#");
                else
                    uriString += c;
            }

    return Uri.parse(uriString);
}

Then Set This :

Intent callIntent = new Intent(Intent.ACTION_CALL, USSDToCallableUri(USSDCodeHere));
startActivity(callIntent);
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
0

Simply Use this method....

String encodedHash = Uri.encode("#");
                    String ussd = "*123"+ encodedHash;
                    startActivity(new Intent(Intent.ACTION_CALL, Uri
                            .parse("tel:" + ussd)));enter code here
Nazik
  • 8,696
  • 27
  • 77
  • 123
-1

Try something like this . Tell me it works or not

 String phone = "*3282#";
 Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", phone, null));
 startActivity(intent);
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
msamardzic
  • 1,060
  • 9
  • 12