Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] contact.delete() fails with exception "Error optaining group id" #92

Open
dlcole opened this issue Feb 15, 2021 · 4 comments
Open

Comments

@dlcole
Copy link
Contributor

dlcole commented Feb 15, 2021

I'm encountering an exception with contact.delete() on an Android device (works OK on emulators). The problem occurs with line 438 of contact-model.android.js:

var rawIdCursor = contentResolver.query(android.provider.ContactsContract.RawContacts.CONTENT_URI, ["_id"], "_id = " + id, null, null);
if (!rawIdCursor.moveToFirst()) {
    throw new Error("Error optaining group id");
    return;
}

So far I haven't been able to determine why rawIdCursor.moveToFirst() fails. At this point I'd welcome any insights. This is with the current plugin version, 1.6.2, and {N} 6.8.0.

[edit]

I was only seeing this on one of two devices, so I reset the failing device to factory settings but am still seeing the same problem, except when I also see issue 83 which prevents my deleteContact() from firing.

@firescript
Copy link
Owner

@dlcole was this resolved?

@dlcole
Copy link
Contributor Author

dlcole commented Mar 2, 2021

No, I've made no progress on this.

@dlcole
Copy link
Contributor Author

dlcole commented Jun 6, 2022

I never really resolved this, and then hit the error again recently when doing some regression testing. My app allows users to add contacts and later remove them. I call getAllContacts() to get the organization name, and if it's the name of the associated event (unique to the contacts I create), I delete it.

I was hitting this error consistently, then changed the code to use getAllContactsWithoutWorker(). I can now delete all the contacts I had earlier added, and this problem no longer occurs. So, this seems like a viable bypass.

Note: I am now using the @nativescript/contacts version of the plugin.

@dlcole
Copy link
Contributor Author

dlcole commented Jun 6, 2022

I spoke too early. The problem still exists; I had commented-out the Throw to do some debugging :-(. I'm not finding a use case where I can delete a contact successfully on Android, but I have to presume most people can or I'd see more issues. Maybe Google syncing the contacts is part of the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants