I making an application in which my requirement is to get the Recently Added or Edited or Deleted Contact in Phonebook. So is there is way to achieve this. Any help will be appreciated.
-
instead of downvote you can cast your comment here.. – droidd Dec 15 '15 at 11:34
-
Have you tried anything? – NoDataDumpNoContribution Dec 15 '15 at 12:45
-
No. No idea how to implement. I have searched it on stackoverflow but could not find anything. – droidd Dec 16 '15 at 04:49
1 Answers
You need to show what you tried, so that we can write our answers based on your try.
First, make sure you have this:
<uses-permission android:name="android.permission.READ_CONTACTS" />
According to the android docs, you can easily read contacts, and, to get specific selections (which is exactly what you want) you can:
Define a search text expression that retrieves rows for a specific contact's LOOKUP_KEY and the Data.MIMETYPE of the details you want. Enclose the MIMETYPE value in single quotes by concatenating a "'" (single-quote) character to the start and end of the constant; otherwise, the provider interprets the constant as a variable name rather than as a string value. You don't need to use a placeholder for this value, because you're using a constant rather than a user-supplied value.
Take a look at the different ways to get specific selection keys on contacts, so that you can get exactly what you want.
http://developer.android.com/training/contacts-provider/retrieve-details.html

- 7,406
- 5
- 48
- 83
-
I think you did not read my question rightly. Just read what i want. i want contact based on only 3 conditions that i mentioned. 1. Recently Added 2. Recently Edited 3. Recently Deleted. Now if you can guide me on this. it will be helpful – droidd Dec 15 '15 at 11:57