My app lets the user select a contact using the contact picker. Afterward lets user selects one or phone phone number to be stored for later use (the numbers are stored in the db)
The trivial solution would have been to save the selected numbers to the database as strings. However I would like to avoid duplicating parts of the the device's contacts list and keep a link (e.g. a URI to a particular number) to that contact.
so far was not able to find a way to do that, the documentation states that the contact id itself might change, So I can only assume it also true for the contacts phone number.
am I missing something ?
From the Android developer documentation, this is all I got:
An indicator of whether this contact is supposed to be visible in the UI. "1" if the contact has at least one raw contact that belongs to a visible group; "0" otherwise.
Essentially what does this mean? What is the purpose of using this flag?
I have tried experimenting with contacts for quite a good amount of time and the results look confusing. When I fetch contacts with this flag ON, it fetches contacts that I believe are the latest synced contacts with my Google account, plus the one that I added locally in my default phone book. For example, this fetches around 912 contacts.
However, with this flag OFF, I get a huge amount of contacts, some which I hardly recognize and don't get it why they are here in the first place. This fetches around 3050 contacts!
Appreciate any help!
Android Contacts are stored within Accounts (Such as Google, Yahoo, Linkedin, Microsoft Exchange), in each Account, contacts are stored in Groups (Such as Friends, Family, Business Contacts) there's also a special group for contacts that don't belong to any group, this group is usually called "All others in <group-name>").
In most contacts apps that ship with Android, a user can select a Custom view in which he can make groups in accounts visible or hidden in the main contacts screen, for example a user can choose to display the Friends group, but not the Family group in his Google Contacts account.
This selection will be referenced by the app querying for contacts by using the IN_VISIBLE_GROUP field, it'll be true if a contact is a part of at least one visible group.
The special All others in group is almost always not a visible group, and so it's usually hidden from the Contacts app.
Specifically in Google, whenever you email someone or get an email from someone, the email address is automatically added to your contacts, to the All others in group, that's why you're probably getting a huge amount of contacts when querying without that flag.
I have a requirement, in which I have to add contacts into phone contact. I have Huawei android phone for which I got account type of phone contact as "com.android.huawei.phone" and account name as "PHONE". Using this data, I successfully inserted the contact and same is also appearing in phone contact. But, this will make my application device specific. Is there any way so that application works on every device? Is there any standard as which account type and name of contact table should be declared?
My problem has been solved. If we assign null to account name and account type, then we can easily add contacts in phone contacts.
I have an application that stores the Contact_ID of contacts. I managed to retrieve the contact_id-s from the phone's Contacts. In some cases I want to make it possible to the user to either call or send a message to the given person behind that contact_id. I don't want to store phone numbers if possible.
So I have a contact_id and I'm wondering whether it is possible to display the list of the contacts with the name behind my contact_id preselected ?
cheers
I need to find contact which saved in my Android phone, But save numbers are repeated in SIM and Google contact, Then That are returning before return Phone contact.
Is there any way to query phone contacts only?
Thank You.
use ContactsContract.Contacts class. it will give you all data for contacts only.