Android accessibilityservice whan screen off

I have a problem with the accessibility service in android. I want to get the result of the USSD command. What am I trying to do:

  • I made AccessibilityService from gist.github.com/qihnus/1909616
  • USSD Transaction: Intent i = new Intent(Intent.ACTION_CALL); i.setData(Uri.parse("tel:*110*10" + Uri.encode("#"))); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_FROM_BACKGROUND); startActivity(i);
  • A popup window opens with the result of USSD
  • In AccessibilityService, onAccessibilityEvent is launched, and I get the text of the result of USSD. And it only works fine when the screen is on. If the screen is off, onAccessibilityEvent is launched only after unlocking the phone.

Is it possible for an AccessibilityEvent call to be called when the screen is off?


Please excuse my bad English, my native language is Ukrainian.

+4
source share

Source: https://habr.com/ru/post/1539872/


All Articles