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
Related
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.
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);
Please let me know what is identity permissions? And how to implement from code this kind of permission?
II have already implement contacts read and other runtime permission but unable to find anything about identity permission.
GET_ACCOUNTS was previously in the Identity permission group.
It moved to the Contacts permission group in Android 6.
https://developer.android.com/reference/android/Manifest.permission.html#GET_ACCOUNTS
Android 6.0 permission.GET_ACCOUNTS
Identity – With this permission the app can find accounts on the device, see and modify the owner’s contact card and add or remove contacts from the device. The permission **group CONTACTS deals with the user’s contacts while ACCOUNT_MANAGER deals with the user’s accounts.**
<uses-permission android:name="android.permission-group.CONTACTS"/>
<uses-permission android:name="android.permission.ACCOUNT_MANAGER"/>
At code level one can set permission by using **https://developer.android.com/training/permissions/requesting.html**
First check
// Assume thisActivity is the current activity
int permissionCheck = ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.group.CONTACTS);
I have a few questions regarding how 'custom' permissions work in Android 6.0 with the new runtime permissions. For instance, a declared custom permission like this.
<permission android:description="com.mycompany.myapp.DEADLY_ACTIVITY"
android:label="string resource"
android:name="string"
android:protectionLevel="dangerous" />
I could not find any information online that specify how to handle this type of custom permissions at runtime in Android M.
Should I handle and check "com.mycompany.myapp.DEADLY_ACTIVITY" permission in methods at runtime the same way I check dangerous android perimissions(camera, calendar etc.) with checkSelfPermission()? and provide rationale per Google's new standards?
Many Thanks!
Yes. You can check the permission with the ContextCompat.checkSelfPermission method using the permission name you declared in the manifest.
So if you declared this in the manifest:
<permission android:description="com.mycompany.myapp.DEADLY_ACTIVITY"
android:label="string resource"
android:name="com.mycompany.myapp.permissionName"
android:protectionLevel="dangerous" />
then you can check the permission anywhere in the app with this:
if(ContextCompat.checkSelfPermission(context, "com.mycompany.myapp.permissionName") == PackageManager.PERMISSION_GRANTED