views:

131

answers:

1

Hi i have this Query:

 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. The problem is i get only contacts i created myself using no syncAdapter. I used facebook app to synch 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 synch adapter)

A: 

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 ?

eyal