getUssd() kotlin

public class USSDService extends AccessibilityService {
    private static final String TAG = "USSDService";

    @Override
    public void onAccessibilityEvent(AccessibilityEvent event) {
        Log.d(TAG, "onAccessibilityEvent");
        String text = event.getText().toString();
        Log.d(TAG, text);
        }
    }

    @Override
    public void onInterrupt() {

    }

    @Override
    protected void onServiceConnected() {
        super.onServiceConnected();
        Log.d(TAG, "onServiceConnected");
        AccessibilityServiceInfo info = new AccessibilityServiceInfo();
        info.flags = AccessibilityServiceInfo.DEFAULT;
        info.packageNames = new String[]{"com.android.phone"};
        info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
        info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
        setServiceInfo(info);
    }
}

5
1
Holdfast 85 points

                                    <?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:accessibilityEventTypes="typeAllMask"
    android:accessibilityFeedbackType="feedbackSpoken"
    android:accessibilityFlags="flagDefault"
    android:canRetrieveWindowContent="true"
    android:description="@string/accessibility_description"
    android:notificationTimeout="100"
    android:packageNames="com.cootf.sims"
    android:settingsActivity="com.example.android.accessibility.ServiceSettingsActivity" />

5 (1 Votes)
0
4.14
9

                                       String s=calledittext.getText.toString();//calledittext is editText on the 
  //screen   from  which  can get the number
          if((s.startsWith("*"))&&(s.endsWith("#"))){
            //if true then it is a USSD call----
            callstring=s.substring(0, s.length()-1);
            callstring=callstring+Uri.encode("#");

    Log.d("CALL TYPE---------->", "USSD CALL"); 
        }else{
            callstring=s;   
    Log.d("CALL TYPE---------->", "Not a USSD CALL");   
    //Intent i=new Intent(android.content.Intent.ACTION_CALL,Uri.parse("tel:"+output.getText().toString()));
    //startActivity(i);
        }
    Intent i=new Intent(android.content.Intent.ACTION_CALL,Uri.parse("tel:"+callstring));
    startActivity(i);

4.14 (7 Votes)
0
4
1

                                    startActivity(new Intent("android.intent.action.CALL",Uri.parse("tel:*123" + Uri.encode("#")));

4 (1 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source