How to read USSD Message response in android

偶尔善良 提交于 2019-12-01 08:04:48

问题


i want to store my balance in sqlite database i am successfully dial the USSD

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

Here is onActivityResult function

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 1) {
    if (resultCode == RESULT_OK) {
            String dd = data.toString();
            Log.d("myussdmessage", data.toString());}}

but I cannot get the string exactly how to do it.I want to store the balance form the dialogue to my database.Can any one suggest me how to do it.


回答1:


You need to build an AccessibilityService in order to do that you need to read the documentation of AccessibilityService in below link https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html

and also this question helped me

Prevent USSD dialog and read USSD response?



来源:https://stackoverflow.com/questions/36912452/how-to-read-ussd-message-response-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!