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
Related
I have a requirement like, I can be able to find the people who are using a particular app from my contacts. It is much similar like Whatsapp contacts syncing.
Whatsapp contacts is so fast & very accurate. What is the logic for it?
I'm not sure of their exact logic, but a way that I have seen it done before is as follows...
Access the phone's contacts (duh)
Get the contact that you want to add as a "friend" in your app.
Cross reference that contact's phone number with the user information that you have stored in your application's database
If that phone number exists in your database of users, then you've got a match and you can process things however you'd like from there.
That's one way of doing it, but I don't know if that's exactly how WhatsApp does it. Hope this helps!
I am trying to get the top contacted call log details in android. Say if the person A has been contacted for 5 times, B has been contacted for 3 times and C 10 times. Now, I want to extract C and A as my top contacted persons in my phone.
Can any body explain me how to do this. I am able to get most recent call logs now.
I referred this, but no luck
How to get contacts with which the user talks often?
I was able to do something similar in a different approach. In the Contacts API, there is a field called ContactsContract.Contacts.TIMES_CONTACTED which tells the number of times that contact has been contacted.
This approach is not related to the CallLogs API. User can clear the CallLogs, but not the times contacted.
Check this link for developer notes on ContactsContract.Contacts.
Check this link for an android library that I have created which can give you this implementation.ae-apps-library You would be looking for the class ContactManager. Once you fetch all the contacts, you need to sort based on the times contacted field to get your required list.
Edit: If you see the fetchAllContacts method in the ContactManager from the library, you can see how the data are read using the API. All you need to do would be to sort this list based on the timesContacted field by writing a Custom Comparator and sorting the list using that.
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
I 'm trying to read and display contacts from phone book in android. My Device is synced up with gmail and funambol which togehter have more than 600 records. Now by default my application reads gmail contacts. On selecting any contact from the displayed list, it throws an exception as the list is displaying a gmail contact which just has email and no phone no.
I need phone no to use in my application.
thanks
Take a look at this answer here. It provides all the detail you need to get the contacts right.
The reason for the crash might be because you are trying to read the phone number when there is none, causing a NullPointerException. Maybe check if it's null before you try and use it, and if it is null then ask the user to pick again.
If this isn't right, feel free to provide more detail like code and logcat logs.
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.