Question: Question:
The question is
- Is it possible to change permissions outside of AndroidManifest.xml?
- About the cause of displaying that permission to image storage is required
Current status
The following items are shown in the access permission when publishing on Google Play.
However, the only thing I remember allowing myself was related to internet connection.
- ID
Search for an account on this device - Contact Search for an account on this device
- Images / media / files
Modify or delete USB storage content
Reading USB storage content - storage
Modify or delete USB storage content
Reading USB storage content - Other Full access to networks that receive data from the Internet Viewing network connections Using an account on this device
The above items are required as permissions.
Since I am using admob ads, I know that I can get the ID etc., but why is it required to have permission to access the image suite?
Below is the manifest file
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
android:value=”@integer/google_play_services_version”
<application
android:allowBackup="true"
android:icon="@drawable/icon_200"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity
android:screenOrientation="portrait"
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
Answer: Answer:
Manifest.permission | From the WRITE_EXTERNAL_STORAGE
section of Android Developers :
If both your minSdkVersion and targetSdkVersion values are set to 3 or lower, the system implicitly grants your app this permission.
Manifest Merging | From the Implicit Permissions section of Android Developers :
Importing a library that targets an Android runtime with implicitly granted permissions may automatically add the permissions to the resulting merged manifest.
For example, if an application with a targetSdkVersion of 16 imports a library with a targetSdkVersion of 2, Android Studio adds the WRITE_EXTERNAL_STORAGE permission to ensure permission compatibility across the SDK versions.
so,
-
The targetSdkVersion / minSdkVersion of my app is 3 or less
-
The targetSdkVersion / minSdkVersion of the dependent library is 3 or less
WRITE_EXTERNAL_STORAGE
permission is implicitly granted in any of the cases (so user permission is required during installation). Other authorities have similar reasoning.
If you know you don't really need this permission, you can add a description to your AndroidManifest.xml to prevent it from being requested … (I just learned).
As mentioned in theMerge Conflict Markers and Selectors section of Manifest Merging above, Manifest Merger has the ability to explicitly override the merge result.
Of these, use the remove
function to remove the originally unnecessary privileges.
<tools: node = ”remove”>
Remove the annotated element from the resulting XML. (Omitted)
Specifically, write the following in your own AndroidManifest.xml.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package=... >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove"/>
...
I tried to explain it by pulling the official document, but I think that the following site is probably easier to understand.