getting all contacts (including from other syncAdapters) in android content handler
private Cursor getContacts(CharSequence constraint) {
boolean hasConstrains = constraint != null && constraint.length() != 0;
Uri uri = ContactsContract.Contacts.CONTENT_URI;
String[] projection = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME };
String selection = hasConstrains ? projection[1] + " LIKE '"+constraint+"%'" : null;
String[] selectionArgs = null;
String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " ASC";
return managedQuery(uri, projection, selection, selectionArgs, sortOrder);
}
The first time issue it I give null
as parameter to the function to the selection parameter is empty
, meaning i don't filter any rows.
syncAdapter
.
I used Facebook app to sync my Facebook contacts, but this query doesn't return them.
I extracted the contacts2.db
from the emulator and the view_contacts
view shows me all the contacts, so the DB is updated.
What should I do to get all the contacts regardless of how they were created (with which sync adap开发者_StackOverflowter).
i've run a search on the subject in google, it seems like facebook chose to have the contacts as 'restricted' though i must say they are not in the table view, of course i can't be sure to which table the contcats.CONTENT_URI will refer to...
Could it be that i can't but for example i will be able to view google synched contacts ?
精彩评论