Hi group.
I want to be able to have persons that are synced wih Google, still
are not visible by default. My idea is to have then in a special group
but not in the system group "Contacts". This is what I do:
I create a Contacts group as follows:
Uri uri = Contacts.Groups.CONTENT_URI;
ContentValues values = new ContentValues();
values.put(Contacts.GroupsColumns.NAME, name);
values.put(Contacts.GroupsColumns.SHOULD_SYNC, 1);
uri = cr.insert(uri, values);
This is how I create a person and add it to this group:
ContentValues personInfo = new ContentValues();
personInfo.put(Contacts.PeopleColumns.NAME, name);
ContentResolver cr = context.getContentResolver();
Uri newEntry = cr.insert(People.CONTENT_URI, personInfo);
Cursor c = cr.query(newEntry, new String[] { BaseColumns._ID }, null,
null, null);
if ((c != null) && (c.moveToFirst())) {
long personId = c.getLong(0);
Contacts.People.addToGroup(cr, personId, groupId);
}
On the emulator this works just fine. But on a real G1 it appears that
after some seconds (possibly after it has been synced with Google) the
contact also belongs to the system group Contacts,
Any idea how to prevent this? To put it more generally, what I need is
to be able to create persons that are part of the contacts list, still
they are not shown by default.
Thank you very much in advance.
Regards
Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---