Skip to content Skip to sidebar Skip to footer

Sending Ussd Code Android

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

Solution 1:

I think you may need to use Uri.encode("*") for the star as well

sendCode.setOnClickListener(newView.OnClickListener() {
        @OverridepublicvoidonClick(View v) {
            // TODO Auto-generated method stubString cUssd = ussdCodeEdTxt.getText().toString();
            String cToSend = "tel:" + Uri.encode("*") + cUssd + Uri.encode("#");
            startActivityForResult(newIntent("android.intent.action.CALL",
                       Uri.parse(cToSend)), 1);
        }
    });

Solution 2:

though this is an old post but, for those facing the same issue try this Uri.fromParts("tel", number eg = *222# , "#");

Post a Comment for "Sending Ussd Code Android"