-
Notifications
You must be signed in to change notification settings - Fork 133
Getting Contacts
vineetmobile edited this page Sep 18, 2013
·
1 revision
SocialAuth Android lets you you get user contacts after authentication. Facebook , Twitter, Linkedin, MySpace, Yammer, Yahoo , FouSquare, Google, Google Plus support this functionality.
###Implementation
private final class ResponseListener implements DialogListener
{
public void onComplete(Bundle values) {
adapter.getContactListAsync(new ContactDataListener());
}
}
// To receive the contacts response after authentication
private final class ContactDataListener implements SocialAuthListener<List<Contact>> {
@Override
public void onExecute(List<Contact> t) {
Log.d("Custom-UI", "Receiving Data");
List<Contact> contactsList = t;
if (contactsList != null && contactsList.size() > 0) {
for (Contact c : contactsList) {
Log.d("Custom-UI", "Contact ID = " + c.getId());
Log.d("Custom-UI", "Display Name = " + c.getDisplayName());
Log.d("Custom-UI", "First Name = " + c.getFirstName());
Log.d("Custom-UI", "Last Name = " + c.getLastName());
Log.d("Custom-UI", "Email = " + c.getEmail());
}
}
Please note different providers support different fields. Here is the list :
- Facebook : First Name, Last Name
- Twitter : Display Name, First Name
- MySpace : First Name, Last Name
- Linkedin : First Name, Last Name
- FourSquare : First Name, Last Name
- Yahoo : First Name, Last Name, Email
- Yammer : Display Name , Email
- Google : First Name, Last Name, Email