react-native-unified-contacts icon indicating copy to clipboard operation
react-native-unified-contacts copied to clipboard

Permission Denial : Opening provider com.android.provider.contact.contactProvider2

Open onusgit opened this issue 5 years ago • 4 comments

I am not access my device contact in android device.

I set Permission in AndroidManifest.xml file

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

screen shot 2018-10-06 at 10 43 30 am

onusgit avatar Oct 06 '18 05:10 onusgit

What Android version?

joshuapinter avatar Oct 06 '18 14:10 joshuapinter

@onusgit I guess you're hitting the same issue as I have, and that is trying to access contacts without first checking for permissions. Check out the methods for this here https://github.com/joshuapinter/react-native-unified-contacts#can-the-user-access-contacts

harunsmrkovic avatar Dec 11 '18 17:12 harunsmrkovic

if your andoid version >=6 ,you should add this in your MianActivity . You can also add it in other place but should be called to ensure the permission when application starts.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, 1);
    }
}

image

@onusgit

the-nippy avatar Jul 08 '19 11:07 the-nippy

if your andoid version >=6 ,you should add this in your MianActivity . You can also add it in other place but should be called to ensure the permission when application starts.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, 1);
    }
}

image

@onusgit

i also have the same errors, you can tell me where exactly should i enter this code, because i entered this code in my code but i have another error

Nargesi1990 avatar Feb 07 '20 11:02 Nargesi1990