-->

Android accessibilityservice whan screen off

2019-06-24 18:29发布

问题:

I have a problem with accessibility service in android. I want to retrive result of USSD command. What I try to do:

  1. I made an AccessibilityService from gist.github.com/qihnus/1909616
  2. Deal USSD: 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);
  3. Popup window with USSD result opens
  4. In AccessibilityService onAccessibilityEvent fired, and I get USSD result text. And it works perfectly only when screen is on. If screen is off, onAccessibilityEvent fired only after I unlock the phone.

Is it possible onAccessibilityEvent to be called when screen is off?


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