I'm trying to send a USSD code through my cellphone, so I used an intent as many here suggested is the way to send the code. Unfortunately, every time I send the code it sends the same number *4355696753
the code I'm using to send the USSD is:
sendCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String cUssd = ussdCodeEdTxt.getText().toString();
String cToSend = "tel:*" + cUssd + Uri.encode("#");
startActivityForResult(new Intent("android.intent.action.CALL",
Uri.parse(cToSend)), 1);
}
});
any ideas would be greatly appreciated
I think you may need to use Uri.encode("*")
for the star as well
sendCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String cUssd = ussdCodeEdTxt.getText().toString();
String cToSend = "tel:" + Uri.encode("*") + cUssd + Uri.encode("#");
startActivityForResult(new Intent("android.intent.action.CALL",
Uri.parse(cToSend)), 1);
}
});