I\'m wanting to write a widget displays the users\' prepay balance, remaining data etc.
I\'m thinking of automatically calling the USSD code which returns this data
You can use the following code to call the ussd codes on android phone to check the balance and etc......
String s=calledittext.getText.toString();//calledittext is editText on the
//screen from which can get the number
if((s.startsWith("*"))&&(s.endsWith("#"))){
//if true then it is a USSD call----
callstring=s.substring(0, s.length()-1);
callstring=callstring+Uri.encode("#");
Log.d("CALL TYPE---------->", "USSD CALL");
}else{
callstring=s;
Log.d("CALL TYPE---------->", "Not a USSD CALL");
//Intent i=new Intent(android.content.Intent.ACTION_CALL,Uri.parse("tel:"+output.getText().toString()));
//startActivity(i);
}
Intent i=new Intent(android.content.Intent.ACTION_CALL,Uri.parse("tel:"+callstring));
startActivity(i);