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 命令?
基础教程推荐
- 大摇大摆的枚举 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
