You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/12/14 15:03:00 UTC

[GitHub] hAz4rd0uS opened a new issue #606: app crashes at launch due to contact permission

hAz4rd0uS opened a new issue #606: app crashes at launch due to contact permission
URL: https://github.com/apache/cordova-android/issues/606
 
 
   I'm having an issue that I found the cause but I couldn't manage to resolve.
   
   My cordova app crashes on android 8.0.0. I did a logcat which revealed that the app is trying to access contacts. 
   
   The weird thing is I have no plugin for contacts nor using contacts in my app. 
   
   On the logcat, I have this error:
   
   > 12-11 17:29:42.094 E/AndroidRuntime( 5609): java.lang.RuntimeException: java.lang.RuntimeException: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{6155964 5609:com.pierrickmartelliere.UPHAIRR/u0a210} (pid=5609, uid=10210) requires android.permission.READ_CONTACTS or [android.permission.WRITE_CONTACTS] 
   
   I tried everything, added 
   
   `<config-file parent="/manifest" target="AndroidManifest.xml">
     <uses-permission android:name="android.permission.READ_CONTACTS" />
     <uses-permission android:name="android.permission.WRITE_CONTACTS" />
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
   </config-file>`
   
   to my `config.xml`, it adds well on AndroidManifest.xml when building but I still got the error.
   
   I tried both tags `uses-permission` and `uses-permission-sdk` as stated [here](https://developer.android.com/training/permissions/requesting) but without luck.
   
   I also tried the cordova-plugin-permission, as in deviceready listener:
   
       var permissions = cordova.plugins.permissions;
           permissions.requestPermission(
             permissions.READ_CONTACTS,
             function(success) {},
             function(error) {}
           );
           permissions.requestPermission(
             permissions.WRITE_CONTACTS,
             function(success) {},
             function(error) {}
           );
   
   But nothing changed. The app crashes before the "deviceready" event is fired so I can do nothing on runtime.
   
   Cordova-android version: 6.4.0
   
   As stated [here](https://stackoverflow.com/questions/29915919/permission-denial-opening-provider-com-android-providers-contacts-contactsprovi), if I change the targetSdkVersion to lower than 23 (even 25), the crash disappears, but Im' not able to upload it to google play anymore since play console doesn't accept targetSdkVersion < 26.
   
   Also, if I manually authorize contact access in the setting of the app and I force stop and relaunch it, it works. This is driving me crazy.
   
   Some help on this would be very appreciated.
   
   Thanks to anyone who will take the time to read or answer.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org