Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1.0
-
None
-
android 6.0
Description
I first checked for the tests if something was wrong with my code, but there doesn't seem to be any concerning PickContact
I always have a permission error, although my AndroidManifest seems correct.
Using 1.1.0 and also tested it with 1.1.1-dev, both have the same issue.
document.addEventListener("deviceready", function () {
navigator.contacts.pickContact(function (contactPicked)
);
});
I get the list of contacts, i can pick one. Instead of returning the ContactInfo, the app crashes and gives a permission error ( which is included)
My Android manifest looks like:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="100009" android:versionName="1.0.1" package="io.cordova.myapp557da2" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-sdk android:maxSdkVersion="23" android:minSdkVersion="19" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:exported="true" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
</activity>
</application>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
</manifest>
The error i'm receiving is :
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/raw_contacts from pid=7739, uid=10141 requires android.permission.READ_CONTACTS, or grantUriPermission()
But READ_CONTACTS permission is included in my AndroidManifest.xml
PS. In my current AndroidManifest.xml i changed
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
So that the parent Activity uses an attribute exported:true, but that doesn't change the error.
There is a whitelist plugin in the app, but everything seems to be added when i look into config.xml
<!-- Support for Cordova 5.0.0 plugin system -->
<plugin name="cordova-plugin-whitelist" version="1" />
<allow-intent href="http:///" />
<allow-intent href="https:///" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>