You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Nico Sap (JIRA)" <ji...@apache.org> on 2015/11/03 22:40:27 UTC

[jira] [Updated] (CB-9947) Can't get PickContact working

     [ https://issues.apache.org/jira/browse/CB-9947?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nico Sap updated CB-9947:
-------------------------
    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) {
                $scope.contact = 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>


  was:
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) {
                $scope.contact = 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.




> Can't get PickContact working
> -----------------------------
>
>                 Key: CB-9947
>                 URL: https://issues.apache.org/jira/browse/CB-9947
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Contacts
>    Affects Versions: 1.1.0
>         Environment: android 6.0
>            Reporter: Nico Sap
>              Labels: android6.0, bug
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> 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) {
>                 $scope.contact = 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>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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