Sending Android USSD Code

I am trying to send a USSD code through my mobile phone, so I used the intention, like many of the ways here to send the code. Unfortunately, every time I send a code, it sends the same number * 4355696753

The code I use to send 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 highly appreciated

+3
source share
1 answer

I think you might need Uri.encode("*") for a 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); } }); 
+2
source

Source: https://habr.com/ru/post/948133/


All Articles