[英]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.我正在尝试通过我的手机发送 USSD 代码,所以我使用了一种意图,因为这里建议的许多意图是发送代码的方式。 Unfortunately, every time I send the code it sends the same number *4355696753
不幸的是,每次我发送代码时,它都会发送相同的数字 *4355696753
the code I'm using to send the USSD is:我用来发送 USSD 的代码是:
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我认为您可能还需要对
Uri.encode("*")
使用Uri.encode("*")
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);
}
});
虽然这是一个旧帖子,但是对于那些面临同样问题的人,请尝试使用这个Uri.fromParts("tel", number eg = *222# , "#");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.