How do I create a group with a source_id reference?
I have been struggling with an issue related to syncing group memberships
and think I figured out the cause, but I don't know how to fix it.
After creating 2 groups , one via code the the other manually and then
query the groups using these columns.
private final static String[] GROUP_COLUMNS = {
ContactsContract.Groups._ID,
ContactsContract.Groups.DATA_SET,
ContactsContract.Groups.NOTES,
ContactsContract.Groups.SYSTEM_ID,
ContactsContract.Groups.GROUP_VISIBLE,
ContactsContract.Groups.DELETED,
ContactsContract.Groups.SHOULD_SYNC,
ContactsContract.Groups.SOURCE_ID,
ContactsContract.Groups.TITLE
};
I can dump out the results as this.
: --- begin ---
: key = title , value = myNewTestGroup
: key = data_set , value = null
: key = _id , value = 45
: key = sourceid , value = null
: key = group_visible , value = 1
: key = system_id , value = null
: key = should_sync , value = 1
: key = notes , value = myNewTestGroup
: key = deleted , value = 0
: --- end ---
: --- begin ---
: key = title , value = Mytest2
: key = data_set , value = null
: key = _id , value = 46
: key = sourceid , value = 144c8b8d0cca8a52
: key = group_visible , value = 1
: key = system_id , value = null
: key = should_sync , value = 1
: key = notes , value = Mytest2
: key = deleted , value = 0
: --- end ---
The manually create group (Mytest2) has a souceid which is listed as a
column in ContactsContract.SyncColumns, while the code generated group has
null.
I see references to source_id in may places in the android docs but I
can't see how to obtain one.
I think somehow i would get this if i associate the group with an account.
Does anyone know how to associate at group with an account, or otherwise
get this source id field set?
No comments:
Post a Comment