Pregunta

I'm reading RawContacts from Google accounts in Android like this.

final Cursor cursor = cr.query(
    ContactsContract.RawContacts.CONTENT_URI, null,
    RawContacts.ACCOUNT_TYPE + " = ?",
    new String[] { "com.google" }, "display_name");
Log.i(TAG, "Start RawContact table");
for (int i = 0; i < cursor.getColumnCount(); i++) {
    Log.d(TAG, i + " : " + cursor.getColumnName(i) + " : "
            + cursor.getString(i) + "\n");
}
Log.i(TAG, "End RawContact table");

However Google plus contacts also get thrown into the mix.

06-10 15:05:11.139: D/Merger(20004): 13 : account_type : com.google
06-10 15:05:11.139: D/Merger(20004): 14 : account_type_and_data_set : com.google/plus

How can I prevent this?

¿Fue útil?

Solución

Answer is very simple. I just didn't see it. Hope this helps someone.

    Cursor cursor = cr.query(
            ContactsContract.RawContacts.CONTENT_URI, null,
            RawContacts.ACCOUNT_TYPE + " IS ? AND "+ RawContacts.DATA_SET+" IS NULL",
            new String[] { "com.google", }, "display_name");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top