Open In App

What is Accessibility Service in Android?

Improve
Improve
Like Article
Like
Save
Share
Report

Android Framework provides a feature of Accessibility services that are designed in a way that provides an alternative way to communicate to the user on the application’s behalf. Users with disabilities can use Android devices and applications with the help of an Accessibility Service. It’s a long-running privileged service that allows people to communicate meaningfully with a device by assisting them in processing information on the phone.

Google provides some accessibility services like, Talkback (for the visually impaired users), Voice Access (for users with an impairment that limits their control over the device), etc. But these services provided by Google alone can’t possibly serve all users with disabilities. As many people with disabilities have special requirements, Android’s accessibility APIs are available, and developers are able to build and deliver accessibility services through the Play Store.

How does the Accessibility service work?

After the user has turned on an Accessibility service, that service will continuously run in the background and receive callbacks from the system when the Accessibility Events are fired. Accessibility Events indicates some change in the user interface’s state, for example, the focus has shifted, a button has been pressed, etc. The system then provides an Accessibility Node Info object that contains the details of the screen content. This node object can be used to perform several actions.

Accessibility Service in Android

Lifecycle

The system manages the lifecycle of an accessibility service, which meets the standard service life cycle. The only way to start an accessibility service is for the user to directly turn it on in the system settings. After the system binds to a service, it calls onServiceConnected() method of the Accessibility service. This method can be overridden by the developers who want to perform some post-binding setup. Basically, onServiceConnected() is the first method that is called when the user turns on the service via system settings. The service keeps on running in the background until either the user turns it off in the device settings or when it calls disableSelf() method.

The development of an accessibility service requires extending this class and implementing its abstract methods. Once the Service is started, it works independently i.e. even if you close the host app or remove it from recent or switch off the screen of your device, the service keeps listening for callback in the background.

You may be curious how an application can read the contents of another application with such ease. Often, take decisions on behalf of consumers. Yes, your concern is justified; an application shouldn’t be able to easily invade a user’s privacy. But for an app to use an accessibility service, it should have permission mentioned in Manifest. And also like other permissions this permission can’t be asked and granted directly at runtime. The user has to explicitly turn on the Accessibility service through system settings

It is always questioned that when the Accessibility services cause a threat to security and privacy why should we use them?

The Accessibility Service is both a blessing and a curse. It has a wide range of features and it enhances user interfaces to help people with disabilities or who are temporarily unable to communicate with the device. Although Accessibility services should only be used to assist users with disabilities, many apps implement this to provide ease of use to everyone. For example,

  1. A user who is driving
  2. A person Taking care of a young child.
  3. A person who is grouped or harassed.
  4. Performing multitasking
  5. Filling forms and many more.

Last Updated : 15 May, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads