<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Speyll&#39;s Writing Endeavors - Android</title>
    <subtitle>Welcome to Speyll&#39;s corner of the internet where creativity thrives in a free-spirited oasis, explore the vast realm of technology and gaming. artist wannabe, open-source enthusiast, Windows and Linux IT, Gain valuable insights and tips to optimize your digital experiences. Delve into captivating game reviews and industry trends. Occasionally, get a glimpse of the person behind the screen as I share anecdotes from my life. take your digital lifestyle to new heights. Join me on this journey as we embrace web creativity and carve our distinctive space in the vast internet&#39;s sea.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://speyllsite.pages.dev/tags/android/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://speyllsite.pages.dev"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2022-10-13T00:00:00+00:00</updated>
    <id>https://speyllsite.pages.dev/tags/android/atom.xml</id>
    <entry xml:lang="en">
        <title>Managing Android Permissions via ADB</title>
        <published>2022-10-13T00:00:00+00:00</published>
        <updated>2022-10-13T00:00:00+00:00</updated>
        
        <author>
          <name>Speyll</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://speyllsite.pages.dev/blog/android-permissions-adb/"/>
        <id>https://speyllsite.pages.dev/blog/android-permissions-adb/</id>
        
        <content type="html" xml:base="https://speyllsite.pages.dev/blog/android-permissions-adb/">&lt;h2 id=&quot;about&quot;&gt;About&lt;/h2&gt;
&lt;p&gt;Managing Android permissions may occasionally be a real pain, especially when Google changes certain tidbits and the applications aren’t updated to reflect the changes in time.&lt;/p&gt;
&lt;p&gt;For instance, the most recent version of Android to date, Tiramisu (13), has three new granular media permissions instead of the old; &lt;code&gt;READ_EXTERNAL_STORAGE&lt;/code&gt; we now have 3 new ones; &lt;code&gt;READ_MEDIA_IMAGES&lt;/code&gt;, &lt;code&gt;READ_MEDIA_VIDEO&lt;/code&gt;, &lt;code&gt;READ_MEDIA_AUDIO&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Recently one of my friends was using an app called &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://f-droid.org/en/packages/com.github.andreyasadchy.xtra/&quot;&gt;Xtra&lt;/a&gt;, a niche alternative front end to the official Twitch app that is significantly superior in my opinion. However, as of the time of writing this, the main developer has not added the new granular permissions to his manifest.&lt;/p&gt;
&lt;p&gt;The app is still fully functional, but when you attempt to download a VOD, it simply sends a request to &lt;code&gt;READ_EXTERNAL_STORAGE&lt;/code&gt;, which is no longer supported in Android 13; the request fails, and you are left stuck unable to download the VOD.&lt;/p&gt;
&lt;p&gt;Giving Xtra the three new permissions manually is the answer, isn’t it? Yes… but no.
In more recent Android versions, Google decided that users may no longer assign any permission to any app via the graphical user interface (GUI), presumably for security concerns, So the app will not appear in your permission manager for that specific permission if it does not provide it in the manifest.&lt;/p&gt;
&lt;p&gt;Fortunately, if you have an USB cable and a computer running Windows, Linux, or MacOS, we can bypass the GUI and use the adb command line to add the necessary permission.&lt;/p&gt;
&lt;h2 id=&quot;how-to&quot;&gt;How to&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First, you will need to download &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://developer.android.com/studio/releases/platform-tools&quot;&gt;SDK Platform Tools&lt;/a&gt;&lt;/p&gt;
&lt;figure class=&quot;center&quot;&gt;&lt;img src=&quot;https://i.ibb.co/zrpJkXB/sdkdownload.webp&quot; alt=&quot;SDK Platform Tools&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;&lt;/figure&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Extract the SDK to a directory.&lt;/p&gt;
&lt;figure class=&quot;center&quot;&gt;&lt;img src=&quot;https://i.ibb.co/wz9vQf3/sdkdirectory.webp&quot; alt=&quot;Extract SDK&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;&lt;/figure&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open a terminal and &lt;code&gt;cd&lt;/code&gt; to the directory. If you hit &lt;strong&gt;SHIFT + Right click&lt;/strong&gt; on the directory itself, Windows will prompt you to launch Powershell, allowing you to quickly start a terminal on that directory.&lt;/p&gt;
&lt;figure class=&quot;center&quot;&gt;&lt;img src=&quot;https://i.ibb.co/fkFyRSL/powershell.webp&quot; alt=&quot;Open terminal&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;&lt;/figure&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Before starting to fiddle with the terminal, make sure you connect your Android device to the PC via a USB cord and turn on USB Debugging in your dev tool settings.&lt;/p&gt;
&lt;p&gt;If you don’t see the developer options in your settings, on Android 4.2 and higher, you must tap the Build Number option 7 times. You can find this option in one of the following locations, depending on your Android version:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Android 9 and higher: Settings &amp;gt; About Phone &amp;gt; Build Number&lt;/li&gt;
&lt;li&gt;Android 8.0.0 / 8.1.0: Settings &amp;gt; System &amp;gt; About Phone &amp;gt; Build Number&lt;/li&gt;
&lt;li&gt;Android 7.1 and lower: Settings &amp;gt; About Phone &amp;gt; Build Number&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now we can go back home; the terminal first start by typing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.\adb devices
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will display a list of all currently connected Android devices, as illustrated below.&lt;/p&gt;
&lt;figure class=&quot;center&quot;&gt;&lt;img src=&quot;https://i.ibb.co/1sgQRnz/devices.webp&quot; alt=&quot;List devices&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;&lt;/figure&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your device is &lt;strong&gt;unauthorized&lt;/strong&gt; like mine is, you don’t need to worry; all you need to do is either revoke USB debugging authorizations or disable and then re-enable USB debugging such that it prompts you for your computer’s RSA key.&lt;/p&gt;
&lt;figure class=&quot;center&quot;&gt;&lt;img src=&quot;https://i.ibb.co/4MKmhBL/prompt.webp&quot; alt=&quot;Unauthorize prompt&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;&lt;/figure&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Next, access the shell with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.\adb shell
&lt;/code&gt;&lt;/pre&gt;
&lt;figure class=&quot;center&quot;&gt;&lt;img src=&quot;https://i.ibb.co/9hfKQPp/shell.webp&quot; alt=&quot;Access shell&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;&lt;/figure&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Last but not least, now that we are in our phone shell, we can do a variety of things. One of them is changing permissions by entering:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pm grant &amp;lt;package-name&amp;gt; &amp;lt;permission&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can get the package-name either by using a root explorer, If it’s on F-Droid, you can typically find the package name in the URL, or you can download &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://play.google.com/store/apps/details?id=com.csdroid.pkg&amp;amp;hl=en&amp;amp;gl=US&quot;&gt;Package Name Viewer 2.0&lt;/a&gt; even though I dislike downloading an entire software for such a simple operation.&lt;/p&gt;
&lt;p&gt;In our case f-droid.org/en/packages/“com.github.andreyasadchy.xtra”
So the commands would be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pm grant com.github.andreyasadchy.xtra android.permission.READ_MEDIA_IMAGES
pm grant com.github.andreyasadchy.xtra android.permission.READ_MEDIA_VIDEO
pm grant com.github.andreyasadchy.xtra android.permission.READ_MEDIA_AUDIO
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It’s that easy.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
        
    </entry>
</feed>
