Search code examples
androidtalkback

Android TalkBack says repeatedly "Service [my app name]"


I have a popular read aloud app, that is also often used by visually impaired and blind people. Some, very few of them complain that when using the app or having it read aloud, it repeatedly says "Service at Voice" (my app's name is @Voice Aloud Reader). I tested this on several phones with different versions of Android and TalkBack enabled, but couldn't reproduce this problem.

The app is showing a notification with reading progress and buttons to pause/resume, FF and reverse etc. Of course all the reading aloud is done from a service, not activity, because a user may want to close my activity, or even turn off screen, and still listen. I would gladly post more technical details, but don't know which ones are relevant.

I tried searching for any combination of terms "TalkBack saying 'service' repeatedly", but cannot find anything relevant. My users who contacted me about this could not find either any setting in TalkBack app to make it stop saying this. Could anyone shed some light on this issue?


Solution

  • I found the reason for my problem, part of it was my own app code, and part just confusing behavior of Android system and TalkBack on different devices. Here is what was happening:

    The app, @Voice Aloud Reader, reads text loaded into it (web pages, docs, books) and highlights the sentence it reads aloud. On each change of sentence it updates progress, both on its own screen if visible, and in the notification. The notification update code is pretty old, from Android 4 days. I did not know then how to update the content of notification, it seemed to me that the only way to update it, after using NotificationBuilder to update content, was to call in my service again:

    startForeground(/* id: */ 1000, myNotifBuilder.build());
    

    It worked well for years, also under TalkBack, no problems. Even today on at least 5 test devices I have with Android 5 to 9 and with emulators, TalkBack activated, it works correctly. But some users reported that upon reading each new sentence (progress update), TalkBack says "Service @Voice". I finally updated the code as follows, and my users report that the problem is solved:

            if (newNotification) {
                startForeground(/* id: */ 1000, myNotifBuilder.build());
            }
            else {
                NotificationManagerCompat.from(this).notify(1000, myNotifBuilder.build());
            }
    

    I doubt that this knowledge will help many people, now notifications are documented better and there is a clear "Update notification" chapter that explains how to do this correctly in Google documents for developers.