I would like to read contacts from ContactsContract API which belongs only to Phone / SIM and would like to avoid contacts synced from other apps like facebook and gmail. I tested my code on simulator and it works fine but on real devices it doesn't returns any result.
ContentResolver cr = AndroidContext.getContext()
.getContentResolver();
Cursor nativeContacts = cr.query(RawContacts.CONTENT_URI,
new String[] { RawContacts._ID, RawContacts.VERSION, RawContacts.CONTACT_ID },
RawContacts.DELETED + "<> 1 AND " + RawContacts.CONTACT_ID
+ " IS NOT NULL AND " + RawContacts.ACCOUNT_NAME + " IS NULL AND "
+ RawContacts.ACCOUNT_TYPE + " IS NULL", null, null);
I guess on devices the account type and name for default account is not null, what is the solution?