android – Preventing USSD dialog and read USSD response. (year 2020 Solution)-ThrowExceptions

Exception or error:

Follow the top rated answer from this link:
Prevent USSD dialog and read USSD response?

Then add this piece of code in your MainActivity.java under the onCreate section:

Intent openSettings = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
openSettings.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(openSettings);

Once you run your app, the phone will ask you to set the Accessibility setting of your installed app to ON.
If it doesn’t, then manually go to your phone’s settings, under the Accessibility section, set it to ON.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *