AccessibilityService - Accessibility Service

This is an example of an accessibility service that provides custom feedback for the Clock application which comes by default with Android devices. It demonstrates the following key features of the Android accessibility APIs:

  1. Simple demonstration of how to use the accessibility APIs.
  2. Hands-on example of various ways to utilize the accessibility API for providing alternative and complementary feedback.
  3. Providing application specific feedback — the service handles only accessibility events from the Clock application.
  4. Providing dynamic, context-dependent feedback — feedback type changes depending on the ringer mode.
  5. Application specific UI enhancement — application domain knowledge is utilized to enhance the provided feedback.

Note: This code sample will work only on devices shipped with the default Clock application. If you are running Android 1.6 of Android 2.0 you should enable first ClockBack and then TalkBack since in these releases accessibility services are notified in the order of registration.

Steps to exercise the ClockBack example:

    • Action: Enable accessibility and all default accessibility services:
      Settings → Accessibility → select the Accessibility, TalkBack, KickBack, and SoundBack checkboxes
    • Result: The system provides spoken, audible, and haptic feedback.
    • Action: Explore the feedback provided by the system:
      Poke around with the trackball.
    • Result: You are somehow familiar with the type of the provided feedback.
    • Action: Go to the Clock application and try to change the time of an alarm:
      All applications → Clock → Alarms (left corner) → Select an alarm → Time — explore the plus, minus buttons, hour and minute edit boxes.
    • Result: The hour and minute edit boxes are announced without any clue which is the hour and which is the minute one (you can guess from the arrangement).
    • Action: Enable ClockBack:
      Settings → Accessibility → ClockBack — select the checkbox (assuming you have installed the APK).
    • Result: We have active accessibility service for providing application specific feedback for the Clock application.
    • Action: Go to the Clock application and try to change the time of an alarm:
      All applications → Clock → Alarms (left corner) → Select an alarm → Time — explore the hour and minute edit boxes.
    • Result: The hour and minute edit boxes are now spoken. This is an example of application specific feedback that utilizes domain information to enhance the user experience.
    • Action: Set the ringer to vibration mode and explore the provided feedback:
      Use the device button for reducing the ringer volume until it is in vibration mode. Move around the Clock application and outside of that application.
    • Result: The Clock application provides custom audible and default haptic feedback. The rest of the system provides the default feedback.
    • Action: Set the ringer to muted mode and explore the provided feedback:
      Use the device button for reducing the ringer volume until it is in muted mode. Move around the Clock application and outside of that application.
    • Result: The Clock application provides only custom haptic feedback. The rest of the system provides the default feedback. Now we are providing custom context dependent feedback based on the device state (ringer mode).
    • Action: Write an accessibility service:
      The Eyes-Free open source project has more accessibility-related resources. To contribute, visit the project page or post to the mailing list.
    • Result: One more cool application has been written.

You can find the source code for this sample in your SDK at:

<sdk>/platforms/android-<version>/samples/