0

I'm working in Accessibility Service. i need to get the app name using Accessibility Service. i have studied the documentation of the Accessibility Service in developer's of Android website. but there is no mention about getting the app name using Accessibility.

Is this possible to get the name of the application? i think its possible because talk back getting name of the application. So if there is any way to get name of the application, Please give your suggestion.

Justin
  • 20,509
  • 6
  • 47
  • 58
Happy
  • 1,031
  • 10
  • 26
  • You should consider adding the tag "TalkBack" to posts about android accessibility. Also, when dealing with frameworks/APIs you are unfamiliar with, it's a good idea to provide your motivation. While the specific thing you're accomplishing may not be possible, those who know the APIs well, may be able to come up with a better alternative than you would on your own. Just ensure to keep it specific enough to be a StackOverflow question, and not get down-voted! – MobA11y Jun 30 '15 at 13:08

1 Answers1

2

You can't get the "app name" of the application. At least not reliably. The strings that the app reads out are things like the title of the Title Bar, or the string underneath the apps icon. It never actually directly asks the framework for the title of the app it is attached to.

You do, however, have access to the application package.

someAccessibilityNodeInfo.getPackageName();

This uniquely identifies the application that a given AccessibilityNodeInfo was sent from.

You could also consider using this:

someAccessibilityService.getRootInActiveWindow();

And crawl down the view hierarchy looking for a title bar.

MobA11y
  • 18,425
  • 3
  • 49
  • 76