QuisApp / flutter_contacts

MIT License
88 stars 143 forks source link

Contact Providers #115

Closed chandrabezzo closed 1 year ago

chandrabezzo commented 1 year ago

I found an error when request access contact

E/AndroidRuntime(16047): java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{277cc9a 16047:your.package.name/u0a178} (pid=16047, uid=10178) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
E/AndroidRuntime(16047):    at android.os.Parcel.createExceptionOrNull(Parcel.java:3011)
E/AndroidRuntime(16047):    at android.os.Parcel.createException(Parcel.java:2995)
E/AndroidRuntime(16047):    at android.os.Parcel.readException(Parcel.java:2978)
E/AndroidRuntime(16047):    at android.os.Parcel.readException(Parcel.java:2920)
E/AndroidRuntime(16047):    at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:5224)
E/AndroidRuntime(16047):    at android.app.ActivityThread.acquireProvider(ActivityThread.java:7007)
E/AndroidRuntime(16047):    at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:3420)
E/AndroidRuntime(16047):    at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:2526)
E/AndroidRuntime(16047):    at android.content.ContentResolver.query(ContentResolver.java:1203)
E/AndroidRuntime(16047):    at android.content.ContentResolver.query(ContentResolver.java:1151)
E/AndroidRuntime(16047):    at android.content.ContentResolver.query(ContentResolver.java:1107)
E/AndroidRuntime(16047):    at co.quis.flutter_contacts.FlutterContacts$Companion.select(FlutterContacts.kt:173)
E/AndroidRuntime(16047):    at co.quis.flutter_contacts.FlutterContacts$Companion.select$default(FlutterContacts.kt:55)
E/AndroidRuntime(16047):    at co.quis.flutter_contacts.FlutterContactsPlugin$onMethodCall$2.invokeSuspend(FlutterContactsPlugin.kt:208)
E/A

On manifest we has been registered permissions

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

On android/build.gradle we have kotlin version

    ext.kotlin_version = '1.7.10'

For request method we use API from this plugin

    final flutterContactsPermission = await FlutterContacts.requestPermission(
      readonly: true,
    );
chandrabezzo commented 1 year ago

Solved, I try to access contact without contacts granted