0

i have tried the following things but not getting the desired output. please help.

    public class LCD_Test extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    //      setContentView(R.layout.activity_lcd__test);
            Intent callIntent = new Intent(Intent.ACTION_DIAL);
    //      String imei_encode=Uri.encode("*#06#"); // encode this as *%2306%23*
            String imei="*#06#";
            callIntent.setData(Uri.parse("tel:"+(imei)));
    //      callIntent.setData(Uri.parse("tel:"+(imei_encode))); 
//Error Invalid USSD code
            startActivity(callIntent);

    //      Intent shortcutIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+Uri.encode("*#0*#")));
    //      startActivity(shortcutIntent);
        }


    }
Anchit Mittal
  • 3,412
  • 4
  • 28
  • 48
  • possible duplicate of [Call (and get the response for) a USSD Code, in the background?](http://stackoverflow.com/questions/4193343/call-and-get-the-response-for-a-ussd-code-in-the-background) – CodingIntrigue Jul 17 '13 at 07:08
  • yeah but it is written in one comment that it may be hopefully added to gingerbread, so i was trying to get it done with using API for JellyBean. But NO solution to the problem – Anchit Mittal Jul 17 '13 at 07:17
  • @Blade0rz and all others methods i have tried – Anchit Mittal Jul 17 '13 at 07:17

3 Answers3

0

try with startActivity(new Intent("android.intent.action.CALL",Uri.parse("tel:*123" + Uri.encode("#")));

chaitanya
  • 1,726
  • 2
  • 17
  • 13
0

You can use this code you get solution of your app

Intent out = new Intent();
out.setAction(Intent.ACTION_DIAL);
out.setData(Uri.parse("tel:" + Uri.encode("+12345#123")));
startActivity(out);
DynamicMind
  • 4,240
  • 1
  • 26
  • 43
0
Intent calli=new Intent(Intent.ACTION_CALL);

 if ( phno.contains( "#" ))

    phno = Uri.encode(phno+"#");

 calli.setData(Uri.parse("tel:"+( phno ) ) );

 startActivity(calli);

//where phno is string that contains phone number eg *123# or 123456789
Mohsen Safari
  • 6,669
  • 5
  • 42
  • 58
Ganin
  • 1