I started targeting Android 13 with API 33. The app is requesting Manifest.permission.READ_EXTERNAL_STORAGE for the older APIs. Now I know that I have to request the new permissions: READ_MEDIA_IMAGES and READ_MEDIA_VIDEO.
I have added in the manifest:
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
and now, as a result, in the setting of the permissions for the app I see an extra option to enable these permissions.
What I can't do is to ask the permission at runtime
If I try to access Manifest.permission.READ_MEDIA_IMAGES in the code I get unresolved reference so I can't dynamically request the permission and if I don't then the user needs to do it manually.
How to handle the READ_MEDIA_IMAGES and READ_MEDIA_VIDEO?
According to official documentation https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions, you should ask permission in runtime.
Also notice:
Note: If your app only needs to access images, photos, and videos, consider using the photo picker instead of declaring the READ_MEDIA_IMAGES and READ_MEDIA_VIDEO permissions.
Related
I have requested below two permissions in app,
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO " />
Then I allow the permissions, and verify from 'App permissions'
But, the app still dont have the READ_MEDIA_VIDEO permission, e.g the below code return false. And the app cannot access/read the videos from device.
ContextCompat.checkSelfPermission(
context!!,
Manifest.permission.READ_MEDIA_VIDEO
) == PackageManager.PERMISSION_GRANTED
If your app only needs to access images, photos, and videos, consider using the photo picker instead of declaring the READ_MEDIA_IMAGES and READ_MEDIA_VIDEO permissions.
More details available here
According to Google storage documentation. It seems that for non-media files no permission is needed.
In my Application I'm using expo-image-picker to pick image to update the user's profile picture.
I had done the implementation. while implementing I used CAMERA_ROLL as type to check the permissions for Gallery.
By Default Expo is includes all permissions link. I don't need that. I need to use only CAMER_ROLL as permission. I went through the app.json configuration docs but there, I can't find CAMER_ROLL or GALLERY related permissions.
What permission to be added in app.json for CAMERA_ROLL ?
You need to add these permissions to your AndroidManifest.xml file.
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
I also had similar scenario. CAMERA_ROLL permission is all about reading and writing to the storage memory. So, it requires below Android permission needs to be added in app.json
READ_EXTERNAL_STORAGE
WRITE_EXTERNAL_STORAGE
enter image description here
I want my app to ask for Photos/Media/Files permission since a third party library requires it, can anyone tell me which specific permission to ask for.
Thanks
Files, photos and media are saved in storage. Your android app will request permission in the relation of what it requires to do. Add the permissions in your Manifest file.
The permission you require is:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
If you want to save Files with your app too, request:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Android versions from Marshmallow and above require runtime grant of permissions. Run the following
String[] PERMISSIONS = {
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
};
ActivityCompat.requestPermissions(this,
PERMISSIONS,
PERMISSION_REQUEST_READ_FOLDERS);
According to the Android documentation (https://developer.android.com/reference/android/provider/ContactsContract.Profile.html), I need to request the android.permission.READ_PROFILE permission to read the user's profile information.
However, when I attempt to create runtime permission request, there is no Manifest.permission.READ_PROFILE I can use. Do I just use the Manifest.permission.READ_CONTACTS permission instead?
Note: The AndroidManifest.xml file can find the permission just fine:
<uses-permission android:name="android.permission.READ_PROFILE" />
READ_PROFILE permission was removed on API 23 as you can see here
https://developer.android.com/sdk/api_diff/23/changes.html
You should ask for GET_ACCOUNTS, or any of the permissions belonging to the CONTACTS group
https://developer.android.com/guide/topics/permissions/requesting.html#perm-groups
When I start to install myapp.apk, I get the below screen.
My app requires Location, External Storage permission. Above permissions are supposed to be requested from user as required i.e. just before the code which required these permissions.
Now , when app is installed I get a screen which say App doesn't require any special access as in the screen below. Why?
This is my permission code in Manifest file.
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.previders.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
With Android 6.0, was introduced the new Android permissions runtime control. Shortly: on older devices all permissions were provided on install of app, from Android M needed permission is used only on runtime, when it is really needed, like Camera activity.
Are you overwriting app? This scenario happens when you already have app installed and installing same app or same app with new version.
If you don't have any new permission added in new app then it will show like that.
As Jadav Lalit already said:
if you install an app it will ask for the permissions it needs. This is also the case for installing, uninstalling and re-installing an app.
if you reinstall or install a newer version of the app without new permissions, it will not ask for any permissions.
On a side note, if you only need Location and External Storage permission you should only have ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, READ_EXTERNAL_STORAGE and maybe WRITE_EXTERNAL_STORAGE.
You could also add ACCESS_LOCATION_EXTRA_COMMANDS since you use location.
Anyhow a complete list is here: https://developer.android.com/reference/android/Manifest.permission.html
They are all there and up to date, but the description can be a little short sometimes.
A more descriptive list is here: http://androidpermissions.com/ but seems a little out of date updated.