1

I am trying to render custom notifications in Android Remote Views that have the following layout.

 --- --- --- --- --- --- --- --- --- ---- -----
|   -------------  -------------------         |
|  |  ImageView |  | TextView (Title) |        |
|  |  Icon      |  --------------------        |
|  --------------  --------------------------  |
|                  | TextView |  Chronometer | |
|                  --------------------------  |
|  ------------------------------------        |
|  |                                   |       |
|  |            ImageView              |       |
|  |                                   |       |
|  -------------------------------------       |
|                                              |
|        ---------------------------           |
|       |        Button             |          |
|       -----------------------------          |
-----------------------------------------------                 

SET UP

In this remote view set up, the text view representing shows a count down timer using a Chronometer widget. The starting time is determined by the backend and is configured programmatically when the remote view is constructed.

The notifications are rerendered when there are 60 seconds to go before the timer expires, and when the timer has expired. So if the start time for the chronometer widget is 3 minutes, the chronometer will countdown from 03:00 -> 02:59, 02:58 all the way to 00:00.

The notifications are rerendered when the timer value is 01:00, i.e. the timer has one minute to expire, and when the timer value is 00:00 i.e. the timer has already expired. I use an alarm manager to render the notification at those times.

All of these custom notifications are defined within a relative layout in which the alignments are set respective to each other.

ISSUE

When the talk back is turned on, the voice over announces the current time when the notification is focussed for just the first time. i.e. if the start time is 03:00 to use the example in the set up, the the voice over announces the title text content, and body text content of the body at time = 03:00. But the talkback does not announce the updated notification content when it is rerendered with a minute to go, and when the timer has already expired.

DESIRED BEHAVIOUR

I want talkback to announce that the notification has been rendered again. If I were to assign an attribute. I have mentioned that all of these widgets are defined in a RelativeLayout, so I were to assign the attribute android:accessibilityLiveRegion="polite" to the RelativeLayout, as suggested in this article, then it announces the countdown timer every second, which I don't want.

I want the voice over to announce that the notification has been rerendered with one minute to go, and when the notification has expired. How do I do that? Android codelab does not seem to contain any information either. I have read the Accessibility for developers section but I can't figure out how to implement this feature. I had thought that I would need AccessibilityDelegate, but I can't find any useful material about that.

halfer
  • 19,824
  • 17
  • 99
  • 186
Kartik
  • 2,541
  • 2
  • 37
  • 59
  • Hi, were you able to find the solution for this? I am also facing a similar issue with countDown timer where a textview is updating each second. – dhar619 Sep 13 '21 at 13:55

0 Answers0