拨打USSD代码?

时间:2012-04-18 17:42:44

标签: android

当我直接从听筒拨打电话时,它可以工作。例如:* 123#获得数字平衡。

但是,当我尝试在应用程序中执行相同的操作时,我遇到了问题。拨号器中显示的数字缺少结尾#。 我在我的应用程序中需要它,我希望我的应用程序应该支持所有USSD代码。

有没有办法在应用程序中拨打ussd代码?

2 个答案:

答案 0 :(得分:19)

我不完全确定,但我认为Android上尚不支持USSD,但是您可以尝试这种解决方法:

String encodedHash = Uri.encode("#");
String ussd = "*" + encodedHash + "123" + encodedHash;
startActivityForResult(new Intent("android.intent.action.CALL",
Uri.parse("tel:" + ussd)), 1);

答案 1 :(得分:0)

String encodedHash = Uri.encode("*123#");
startActivityForResult(new Intent("android.intent.action.CALL",
Uri.parse("tel:" + encodedHash)), 1);