Manifest.permission.READ_PROFILE not found

[亡魂溺海] 提交于 2019-12-11 15:57:18

问题


While working on an Android application I am required to grant permission for reading/writing for contacts and profile. I found Android manifest file have possible permissions like,

<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.WRITE_PROFILE"/>

And I am able to show request runtime permission for Contacts i.e.,

ActivityCompat.requestPermissions(this,
        new String[]{Manifest.permission.READ_CONTACTS},
        MY_PERMISSIONS_REQUEST_READ_CONTACTS);

However when I put below code, It says READ_PROFILE is not found.

ActivityCompat.requestPermissions(this,
        new String[]{Manifest.permission.READ_PROFILE},
        MY_PERMISSIONS_REQUEST_READ_PROFILE);

How can I request runtime permission for reading/writing profile. I am using,

Intent intent = new Intent(Intent.ACTION_EDIT, ContactsContract.Profile.CONTENT_URI);
MainActivity.this.startActivity(intent);

But after editing profile info, when I save it does not update the profile rather shows a toast like,

Nothing to save. Contact discarded

Is it a permission issue? How can I update profile info successfully?


回答1:


READ_PROFILE permission was removed on API 23 as stated here:

https://developer.android.com/sdk/api_diff/23/changes.html

Use GET_ACCOUNTS instead.

https://developer.android.com/guide/topics/permissions/requesting.html#perm-groups



来源:https://stackoverflow.com/questions/56220207/manifest-permission-read-profile-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!