[英]Android App Development call doesnt call full USSD code
我的应用程序当前在AT&T的USSD代码末尾未生成用于检查数据使用的最终“#”(应该是* 3282#)
这是我的代码:
public void callATT(View view){
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "*3282#"));
startActivity(intent);
}
每次调用它都只调用“ * 3282”
请帮我,
提前致谢
-Tucker
试试这个,我没有测试,但是应该可以。
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Uri.encode("*3282#")));
startActivity(intent);
public Uri USSDToCallableUri(String ussd) {
String uriString = "";
if(!ussd.startsWith("tel:"))
uriString += "tel:";
for(char c : ussd.toCharArray()) {
if(c == '#')
uriString += Uri.encode("#");
else
uriString += c;
}
return Uri.parse(uriString);
}
然后设置:
Intent callIntent = new Intent(Intent.ACTION_CALL, USSDToCallableUri(USSDCodeHere));
startActivity(callIntent);
只需使用此方法即可。
String encodedHash = Uri.encode("#");
String ussd = "*123"+ encodedHash;
startActivity(new Intent(Intent.ACTION_CALL, Uri
.parse("tel:" + ussd)));enter code here
尝试这样的事情。 告诉我它是否有效
String phone = "*3282#";
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", phone, null));
startActivity(intent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.