3

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.

Martin
  • 429
  • 3
  • 18
Nouman Shah
  • 534
  • 1
  • 9
  • 22

1 Answers1

3

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?

Community
  • 1
  • 1
Martin
  • 429
  • 3
  • 18