如何在安卓上运行 USSD 命令? [英] How to run USSD commands on android?

查看:23
本文介绍了如何在安卓上运行 USSD 命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何运行USSD命令来检查手机的信用余额(号码是*123#)并得到结果(信用余额)做进一步处理?谢谢

has anyone know how to runs USSD command for checking phone's credit balance (the number is *123#) and get the result (the credit balance) for further processing?? thankss

推荐答案

您可以在 Android 设备中运行 USSD 代码,但您将无法在应用程序中解析结果.将来可能会将此功能添加到 Android SDK 中,但现在,您必须寻找替代方案.

You can run USSD codes in Android devices but you would be unable to parse the result in your application. This feature might be added to the Android SDK in the future but for now, you would have to look for an alternative.

USSD 可以使用简单的调用意图来运行.见例子:

USSD can be run using simple Call intents. See Example:

String ussdCode = "*" + "123" + Uri.encode("#");
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + ussdCode)));

如评论中所述,还需要通话权限

as mentioned in the comments phone call permission is also required

<uses-permission android:name="android.permission.CALL_PHONE" /

这篇关于如何在安卓上运行 USSD 命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆