joshuapinter / react-native-unified-contacts

Your best friend when working with the latest and greatest Contacts Framework in iOS 9+ in React Native.
MIT License
158 stars 56 forks source link

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

Open onusgit opened 5 years ago

onusgit commented 5 years ago

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

joshuapinter commented 5 years ago

What Android version?

harunsmrkovic commented 5 years ago

@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

the-nippy commented 5 years ago

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

Nargesi1990 commented 4 years ago

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