Google should really document their contacts API, its really irritating to find out how to insert specific details.
Anyways,
I want to send following contact details to Contact native application of android:
Name
Last Name [Family Name]
Street Address
City
State
Zip Code
Contact Phone no.
I have figured out that Family name is stored in ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME
Anyhelp will really be appreciated. And if you know any other columns insertion beyond these mentioned. I am ready to buy it. Only condition is it should use ContactsContract i.e. above android 2.1 API Level 5
Thankx :)
To set the name, your code would be like :
ConactsIntent.putExtra(ContactsContract.Intents.Insert.NAME, firstName);
Try Adding a space in between first name and the last name.
ConactsIntent.putExtra(ContactsContract.Intents.Insert.NAME, firstName+" "+lastName);
ContactsContract.CommonDataKinds.StructuredPostal.STREET
ContactsContract.CommonDataKinds.StructuredPostal.CITY
ContactsContract.CommonDataKinds.StructuredPostal.REGION
ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE
ContactsContract.CommonDataKinds.Phone.NUMBER
You'll find all of them here.
Related
Could you help me to find out how I will get and display contact name.
I am able to get and display the contact number only, but what I need is to get the data of contact name via contact number saved on the phone. This is for my school project purposes.
I am using MIT App inventor. What should I do?
Here is a screenshot of my blocks
The texting component does not provide that information. As you can see, you can only get the number and the message text.
To get the contact name, you could use the Read Contact Extension by Andres Daniel. Note: this is a paid extension.
For a list of available extensions, see https://puravidaapps.com/extensions.php
I am looking to build a local Contacts list in Android. The user selects, say 3 contacts, from the address book and the code needs to save this list locally. The list should include Contact name, mobile number and email address. The user should also be able to edit this list. I am new to Android and struggling to get a solution for this.
The app I am building needs a user to create a local contacts list. I need to be able to extract the full contacts list from the Address Book and then the user gets to choose a limited number of contacts which get saved for later retrieval/modifications.
try Retrieving a List of Contacts in Android Developer.
This link may helps you to retrive the contact list.
Replace book objects with contact objects in the following tutorial and it might be useful...
http://stirfriedcode.blogspot.jp/2013/11/getting-specific-data-from-sqlite.html
I tried a new workaround and adapter-free solution . It's worth to have a look at :
https://github.com/draxdave/ConstraintAccordion
in this question : Android get a cursor only with contacts that have an email listed >android 2.0 DArkO said that has resolved problem of listing only contacts with email. But I still can't figure out what is that filter string he used. I saw someone was asking him in comment, but without any response.
Or maybe someone else know easy way to get contacts with email?
You can query Data table set where clause to mimetype = Email.CONTENT_ITEM_TYPE and get the raw_contact_id. Then using this raw_contact_id you can get any info about this contact.
I'm making android app that tells you the operator's name of your contact's number.
Is there a way to put a label containing the name of the operator next to every number directly in the contacts list?
You will need to create your own sync provider and your own RawContacts table. Fill it up with name, phone number and the data you need (e.g., the operator name). Not an easy. task There's a very nice post with lots of details here:
http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/
http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/
There's an example in the android Technical Resources pages: http://developer.android.com/resources/samples/SampleSyncAdapter/index.html
Following up on this question:
Android: Manage contacts with lookup key
(see below)
I have the same problem. However, it shows with Android 2.1 Update 1, But is OK with Android 2.2.
It seems that the lookup key changes with contact's name change with Android 2.1, but does not change with Android 2.2.
Did anybody else experience this? Any suggested workaround for Android 2.1?
Thanks
Original question by chromate
Hi everybody,
I'm currently writing a application that allows to save drafts (using android version >= 2.0). Each draft is connected to a contact via the ContactsContract.Contacts.LOOKUP_KEY. My problem is that if I change the name of my contact the lookup key changes also. Is that the way this works?
So for what do I need a lookup key? I thought that the lookup key does never change and now it changes anyway. I'm confused about that behavior ...
Can someone explain to me how to link permanently to a contact? Should I use IDs instead of the lookup key?
Thanks in advance.
You can use contact ids instead of that. Look up key is not stable. So do not us look up key. And the benefit of contact id is it won't very. So use contact id. good luck
why don't you find contact id or lookup key via using raw contact id?
this is bug in 2.1.
Lookup key was based on the contact name for unsynced contacts.
http://comments.gmane.org/gmane.comp.handhelds.android.devel/130677
even a lookup key is changed, it will still point to same contact.
from: https://developer.android.com/guide/topics/providers/contacts-provider
The ContactsContract.Contacts table also has the column LOOKUP_KEY that is a "permanent" link to the contact row. Because the Contacts Provider maintains contacts automatically, it may change a contact row's _ID value in response to an aggregation or sync. Even If this happens, the content URI CONTENT_LOOKUP_URI combined with contact's LOOKUP_KEY will still point to the contact row, so you can use LOOKUP_KEY to maintain links to "favorite" contacts, and so forth. This column has its own format that is unrelated to the format of the _ID column.