Amir_P Amir_P - 9 days ago 6
Android Question

Capture what user types in other applications

Hey before today I thought there is no way to capture what user types in other applications based on my searches in stack overflow an other sites but today I saw an application that can offer emojis based on what you type in social applications. How is that possible?
https://play.google.com/store/apps/details?id=co.dango.emoji.gif

Answer

I guess they internally use an AccessibilityService.

This kind of service is intended primarily to assist people with disabilities (something like TalkBack for example). When registered, this service receives AccessibilityEvents. These events are fired for example when the user interacts with the device or the displayed content changes. Internally, they contain a tree of AccessibilityNodeInfos which contain detailed information about the view hierarchy displayed on the screen.

Therefore the app can traverse the AccessibilityNodeInfo tree and extract the text that user enters.

You can read more about AccessibilityServices here.

Bottom line: be careful when you install apps that require the accessibility permission, as they may pose a serious security risk.

Comments