Describe the bug
On Android, when retrieving contacts from the device (which are via Google Contacts), fields are frequently, but not always, duplicated, and sometimes altered.
For example, a contact that has a single email address when viewed in Google Contacts, will return in the following form:
(111-222-3333 is made up for privacy reasons, hiding the real phone number, which has been duplicated and reformatted by the plugin.)
The plug works perfectly, no duplication of entries, on iOS, with the same code base and same contact database.
To Reproduce
I am not sure how to reproduce this without using my contacts, but my code is roughly as follows:
import { Contacts, GetContactsResult, ContactPayload, EmailPayload, PhonePayload, EmailType, NamePayload } from '@capacitor-community/contacts';
...
const projection = { name: true, emails: true, phones: true, image: true, };
let result = await Contacts.getContacts({projection}).catch((err: any) => {
console.log('error on contacts', err);
});
console.log(result);
and the offending contacts are in the result. Not every contact has undergone duplication, but many have been. I cannot see any pattern to when the duplication happens.
I am using Capacitor 6 and "@capacitor-community/contacts": "^6.0.5-alpha.0",
I do not know if Capacitor 6 might be the issue?
Expected behavior
The plugin should not duplicate emails or phone numbers. If they are to be normalized, then only the normalized version should be returned - although normalization of phone #s is fraught with complications...
Screenshots
None, but can be supplied if needed.
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
Device: Samsung Galaxy s8
OS: Android 10
Browser: N/A
Version N/A
Additional context
Changing the projection seems to have no effect, only the requested fields show up, but with the same duplication.
I am seeing similar issue with version 5.0.4 - some contacts are tripled, some doubled while some remain single. Don't see a pattern to explain what's going on.
Describe the bug On Android, when retrieving contacts from the device (which are via Google Contacts), fields are frequently, but not always, duplicated, and sometimes altered.
For example, a contact that has a single email address when viewed in Google Contacts, will return in the following form:
where
<useremail>
is the contact's real email. (also, isPrimary should not be true for two addresses should it?)A contact with one phone number will often return two phone numbers, one of which will have +1 mysteriously prepended to it or be reformatted:
(111-222-3333 is made up for privacy reasons, hiding the real phone number, which has been duplicated and reformatted by the plugin.)
The plug works perfectly, no duplication of entries, on iOS, with the same code base and same contact database.
To Reproduce
I am not sure how to reproduce this without using my contacts, but my code is roughly as follows:
and the offending contacts are in the result. Not every contact has undergone duplication, but many have been. I cannot see any pattern to when the duplication happens.
I am using Capacitor 6 and "@capacitor-community/contacts": "^6.0.5-alpha.0",
I do not know if Capacitor 6 might be the issue?
Expected behavior The plugin should not duplicate emails or phone numbers. If they are to be normalized, then only the normalized version should be returned - although normalization of phone #s is fraught with complications...
Screenshots None, but can be supplied if needed.
Desktop (please complete the following information): N/A
Smartphone (please complete the following information):
Additional context
Changing the projection seems to have no effect, only the requested fields show up, but with the same duplication.
I read this issue, which reports oddness with Android; I do not know if they might be related. https://github.com/capacitor-community/contacts/issues/94