{"id":934,"date":"2021-01-23T22:46:33","date_gmt":"2021-01-23T20:46:33","guid":{"rendered":"https:\/\/mattiesworld.gotdns.org\/weblog\/?page_id=934"},"modified":"2021-02-22T22:51:03","modified_gmt":"2021-02-22T20:51:03","slug":"onscreenclock-permission-fix","status":"publish","type":"page","link":"https:\/\/mattiesworld.gotdns.org\/weblog\/onscreenclock-permission-fix\/","title":{"rendered":"OnScreenClock permission fix"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Context<\/h2>\n\n\n\n<p><em>You can skip this section if you just want the solution<\/em><\/p>\n\n\n\n<p>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 <a href=\"https:\/\/developer.android.com\/reference\/android\/Manifest.permission.html#SYSTEM_ALERT_WINDOW\">SYSTEM_ALERT_WINDOW<\/a> permission, is considered a dangerous permission and requires special care. However, a lot of users got confused when their phone <a href=\"https:\/\/www.google.com\/search?q=android+screen+overlay+detected\">started sayin<\/a>g &#8220;Screen overlay detected&#8221;, 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.<\/p>\n\n\n\n<p>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 &#8220;regular&#8221; permissions).<\/p>\n\n\n\n<p>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. \ud83d\ude42<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Workaround<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">The &#8220;easy&#8221; way<\/h3>\n\n\n\n<p>Unfortunately, there is no easy way yet.. \ud83d\ude42 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 &#8220;techy&#8221; way. If somebody feels up to it, be my guest and I will post it here!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The &#8220;unconventional&#8221; way<\/h3>\n\n\n\n<p>If you have a rooted device, you can simply press the button within the app!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2021\/01\/grant_perm_rooted.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"572\" src=\"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2021\/01\/grant_perm_rooted-1024x572.png\" alt=\"\" class=\"wp-image-952\" srcset=\"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2021\/01\/grant_perm_rooted-1024x572.png 1024w, https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2021\/01\/grant_perm_rooted-300x168.png 300w, https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2021\/01\/grant_perm_rooted-768x429.png 768w, https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2021\/01\/grant_perm_rooted-500x279.png 500w, https:\/\/mattiesworld.gotdns.org\/weblog\/wp-content\/uploads\/2021\/01\/grant_perm_rooted.png 1276w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>This is by far the easiest way, unfortunately, most people don&#8217;t have a rooted device.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The &#8220;hard&#8221; or techy way<\/h3>\n\n\n\n<p>For the tech savvy people, this is the recommended way. Simple type the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">adb shell pm grant mattiesworld.gotdns.org.onscreenclock android.permission.SYSTEM_ALERT_WINDOW<\/pre>\n\n\n\n<p>An obvious prerequisite is that you have <a href=\"https:\/\/developer.android.com\/studio\/command-line\/adb\">adb<\/a> command line tool installed.<\/p>\n\n\n\n<p>Some devices, like Nvidia Shield, provide a network debug option out of the box, so you don&#8217;t even need to connect your TV with a USB cable. Just run the following command before issuing the &#8220;adb shell pm etc..&#8221; command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">adb connect &lt;ip of your tv&gt;<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Context 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 &hellip; <a href=\"https:\/\/mattiesworld.gotdns.org\/weblog\/onscreenclock-permission-fix\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">OnScreenClock permission fix<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-934","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/pages\/934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/comments?post=934"}],"version-history":[{"count":3,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/pages\/934\/revisions"}],"predecessor-version":[{"id":981,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/pages\/934\/revisions\/981"}],"wp:attachment":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/media?parent=934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}