How to get last call from/to contact in android - android

I am trying to retrieve some contacts info. by now what i am using is in this style to get contact's name, phone, organization and email.
{ContactsContract.CommonDataKinds.Phone.NUMBER}
But i have not found a similar simple way to get the last call to/from contact (last time contacted, if you want) so i would appreciate any help
thank you all

Related

How to display name of unknown incomming call number

In my app, I have a database of phone numbers. Each phone number has a name assigned to it.
When user receives incoming call from number that he has not saved in his contacts database I want to display name from my database instead of unknown label...
Is it possible? How can I achieve this?
Would it be possible to also display some additional labels? For example caller's company, gender, age... (all those information will be pulled from my database of course)
So I did some research and found this.
To change display name of incoming call number, I have to add a new contact. That may not be the best approach since it will create contact in user's contacts and will be preserved even after uninstalling the app...
Another option is to display overlay view on which can be shown name (and other labels) from my database. I think I will go with this solution...

Custom Contacts List in Android

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

Get full google contacts list using OAuth

I'm trying to receive the user contact list from gmail using this (http://androidwarzone.blogspot.com.br/2011/07/android-oauth-full-example-with-source.html) tutorial. Everything worked just great, but I'm just receiving 24 contacts, nothing more, nothing less. If i delete an contact that is receiving and try to get the list again, ir brings me another contact placing the deleted spot.
How do I get the full list? There is a better way instead of this tutorial?
All contacts, including gmail, can be queried directly from the contacts content provider on the device.
http://developer.android.com/guide/topics/providers/contacts-provider.html#Access
In the tutorial what u have mentioned, in C.java file, for GET_CONTACTS_FROM_GOOGLE_REQUEST use this url https://www.google.com/m8/feeds/contacts/default/full?max-results=1000&alt=json
Here max-results=1000 means maximum 1000 results to retrieve per request

How to get notified about which contact is deleted or updated from device Phonebook in Android

Using the ContentObserver i get to know that there has been some change in the contacts database but I need to know which contact has been deleted or updated from device contact list. Is there any working example which can achieve the same? Any help would be appreciated.
EDIT
Out of the entire contacts I have in the Phonebook, there is only one particular contact for which I need to know if the content has changed. In such case, can I have an observer just for one specific contact and not for the entire phonebook ?

Possibility of a custom Contacts field with a set list of values and Contacts lookup performance

I'm pretty sure it's not viable to do what I'd like to based on some initial research, but I figured it couldn't hurt to ask the community of experts here in case someone knows a way.
I'd like to create a custom field for contacts that the user is able to edit from the main Contacts app; however, the user should only be allowed to select from a list of four specific values. A short list of string values would be ideal, but an int with a min/max range would suffice.
I'm interested in knowing if it's possible either way, but also wondering if it make sense to go this route performance wise. More specifically, would it be better to look up a contact (based on a phone number) each time a call or SMS message is received or better to store my own set of data (consisting of name, numbers, and the custom field) and just syncing contact info in a thread every so often? Or syncing contacts the first time the app is run and then registering for changes using ContentObserver?
Here is a similar question with an answer that explains how to add a custom field to a contact.
Thanks in advance.
I don't see the purpose to have your own set of data against contacts stored in your separate database, as you obviously will run into sync issues. You can use the mimetype and store whatever you want against the contact, in the manner you linked.
Whenever you want to looup contacts you can do that by using your custom mimetype. You get the contact id (from ContactsContract.Data.CONTENT_URI), and then you run another query to get the contact details (from ContactsContract.Contacts.CONTENT_URI). Please note these are different tables.
I'd like to create a custom field for contacts that the user is able to edit from the main Contacts app
I don't see that possible, editable from the main app, when you use your custom mimetypes, and you don't have much options here. The main contact app will display only the fields that are in SDK. You can store details against contacts but they won't show up in the inbuilt edit contact screen.

Categories

Resources