Merge branch '0.2.11'
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 7c990de..b0e8312 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -83,7 +83,7 @@
* CB-6460: Update license headers
* Add NOTICE file
-### 0.2.11 (Jun 27, 2014)
+### 0.2.11 (Jul 2, 2014)
* CB-6127 Spanish and French Translations added. Github close #25
* Remove deprecated symbols for iOS < 6
* CB-6797 Add license
@@ -96,3 +96,4 @@
* CB-6491 add CONTRIBUTING.md
* Docs typo: navigator.contacts.length -> contacts.length
* CB-5698 ios: Check to see if photoData exists before using
+* CB-7003 android: Make pickContact pick correct contact on Android 4.3 and 4.4.3
diff --git a/src/android/ContactManager.java b/src/android/ContactManager.java
index e1a4568..1bb9c43 100644
--- a/src/android/ContactManager.java
+++ b/src/android/ContactManager.java
@@ -27,7 +27,9 @@
import android.app.Activity;
import android.content.Intent;
+import android.database.Cursor;
import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.RawContacts;
import android.util.Log;
public class ContactManager extends CordovaPlugin {
@@ -161,8 +163,19 @@
if (requestCode == CONTACT_PICKER_RESULT) {
if (resultCode == Activity.RESULT_OK) {
String contactId = intent.getData().getLastPathSegment();
+ // to populate contact data we require Raw Contact ID
+ // so we do look up for contact raw id first
+ Cursor c = this.cordova.getActivity().getContentResolver().query(RawContacts.CONTENT_URI,
+ new String[] {RawContacts._ID}, RawContacts.CONTACT_ID + " = " + contactId, null, null);
+ if (!c.moveToFirst()) {
+ this.callbackContext.error("Error occured while retrieving contact raw id");
+ return;
+ }
+ String id = c.getString(c.getColumnIndex(RawContacts._ID));
+ c.close();
+
try {
- JSONObject contact = contactAccessor.getContactById(contactId);
+ JSONObject contact = contactAccessor.getContactById(id);
this.callbackContext.success(contact);
return;
} catch (JSONException e) {