Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F3679FBD for ; Sat, 4 Feb 2012 03:38:15 +0000 (UTC) Received: (qmail 21941 invoked by uid 500); 4 Feb 2012 03:38:13 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 21868 invoked by uid 500); 4 Feb 2012 03:38:07 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 21852 invoked by uid 99); 4 Feb 2012 03:38:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Feb 2012 03:38:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Feb 2012 03:38:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D1B6531B9A6; Sat, 4 Feb 2012 03:37:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anis@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [3/3] git commit: CB-75 contact.remove does not remove the contact fully Message-Id: <20120204033743.D1B6531B9A6@tyr.zones.apache.org> Date: Sat, 4 Feb 2012 03:37:43 +0000 (UTC) CB-75 contact.remove does not remove the contact fully Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/e0fea2c3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/e0fea2c3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/e0fea2c3 Branch: refs/heads/master Commit: e0fea2c3526115cfe189de59f6e2b00e94b3d6f5 Parents: fa4d6d3 Author: Anis Kadri Authored: Fri Feb 3 19:32:31 2012 -0800 Committer: Anis Kadri Committed: Fri Feb 3 19:32:31 2012 -0800 ---------------------------------------------------------------------- .../src/com/phonegap/ContactAccessorSdk5.java | 17 ++++++++++++-- 1 files changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e0fea2c3/framework/src/com/phonegap/ContactAccessorSdk5.java ---------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/ContactAccessorSdk5.java b/framework/src/com/phonegap/ContactAccessorSdk5.java index 09bd91a..f6bb32a 100644 --- a/framework/src/com/phonegap/ContactAccessorSdk5.java +++ b/framework/src/com/phonegap/ContactAccessorSdk5.java @@ -1617,9 +1617,20 @@ public class ContactAccessorSdk5 extends ContactAccessor { * @param id the unique ID of the contact to remove */ public boolean remove(String id) { - int result = mApp.getContentResolver().delete(ContactsContract.Data.CONTENT_URI, - ContactsContract.Data.CONTACT_ID + " = ?", - new String[] {id}); + int result = 0; + Cursor cursor = mApp.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, + null, + ContactsContract.Contacts._ID + " = ?", + new String[] {id}, null); + if(cursor.getCount() == 1) { + cursor.moveToFirst(); + String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)); + Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey); + result = mApp.getContentResolver().delete(uri, null, null); + } else { + Log.d(LOG_TAG, "Could not find contact with ID"); + } + return (result > 0) ? true : false; }