How to run USSD commands on android?(如何在安卓上运行 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 命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在安卓上运行 USSD 命令?


- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 转换 ldap 日期 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 获取数字的最后一位 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01