You can skip this section if you just want the solution
From Android Marshmallow on, apps need to ask permission to the user for performing certain tasks, e.g. accessing contacts, or in our case: showing something on top of all other apps. Showing things on top, aka the overlay permission or more technically SYSTEM_ALERT_WINDOW permission, is considered a dangerous permission and requires special care. However, a lot of users got confused when their phone started saying “Screen overlay detected”, and big companies like Facebook started getting tons of support requests. So to mitigate the problem Google started (from Android 6.0.1) to grant this permission automatically if the app got installed through the Google Play store.
However, starting January 2019, they gradually started excluding apps from receiving this permission automatically. My little unpopular OnScreenClock app was one of the first apps to go down. In normal Android environment (non-TV), this does not pose a real problem as the user can still grant the permission themself. Unfortunately, on Android TV, there usually is no such user interface for granting the overlay permission (which requires a special user interface in contrast to “regular” permissions).
It becomes gradually more difficult to display something on top of other things, up to the point at which it will probably become impossible. However, until then, a workaround is still possible. 🙂
The “easy” way
Unfortunately, there is no easy way yet.. 🙂 I was going to make a companion phone app to assist in granting the permission but it does not seem so trivial.. Maybe I will create a video explaining how to execute the “techy” way. If somebody feels up to it, be my guest and I will post it here!
The “unconventional” way
If you have a rooted device, you can simply press the button within the app!
This is by far the easiest way, unfortunately, most people don’t have a rooted device.
The “hard” or techy way
For the tech savvy people, this is the recommended way. Simple type the following command:
adb shell pm grant mattiesworld.gotdns.org.onscreenclock android.permission.SYSTEM_ALERT_WINDOW
An obvious prerequisite is that you have adb command line tool installed.
Some devices, like Nvidia Shield, provide a network debug option out of the box, so you don’t even need to connect your TV with a USB cable. Just run the following command before issuing the “adb shell pm etc..” command:
adb connect <ip of your tv>