Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all android contacts but without those which are on SIM

It is possible to do it in one query?

As far as I know content uri of sim contacts is content://icc/adn

like image 795
noisy Avatar asked Dec 02 '10 18:12

noisy


1 Answers

This is very easy! :)

Cursor cursor = mContentResolver.query(
   RawContacts.CONTENT_URI,
   new String[]{RawContacts._ID,RawContacts.ACCOUNT_TYPE},
   RawContacts.ACCOUNT_TYPE + " <> 'com.anddroid.contacts.sim' "
    + " AND " + RawContacts.ACCOUNT_TYPE + " <> 'com.google' " //if you don't want to google contacts also
   ,
   null,
   null);
like image 96
noisy Avatar answered Nov 07 '22 12:11

noisy