Monday, April 26, 2010

[android-developers] Re: How to determine contacts Gmail/Google voice group membership from android phone/emulator

After updating the code to 2.1, I found one solution using the
following code:

d = context.getContentResolver().query( Data.CONTENT_URI,
new String[] {ContactsContract.Contacts.DISPLAY_NAME,
GroupMembership.GROUP_SOURCE_ID,
GroupMembership.GROUP_ROW_ID},
GroupMembership.GROUP_ROW_ID + "=" + groupid + " AND " +
Data.MIMETYPE + "='" +
GroupMembership.CONTENT_ITEM_TYPE + "'",
null,
"DISPLAY_NAME");


The accomplishes the goal the long route. But when I try to cut a lot
of cursor placements with the following code everything fails:

d = context.getContentResolver().query( Data.CONTENT_URI,
new String[] {ContactsContract.Contacts.DISPLAY_NAME,
GroupMembership.GROUP_SOURCE_ID,
GroupMembership.GROUP_ROW_ID},
GroupMembership.DisplayName + "=" + name + " AND " +
Data.MIMETYPE + "='" +
GroupMembership.CONTENT_ITEM_TYPE + "'",
null,
"DISPLAY_NAME");

Can anyone point out why it fails and what I can do to correct this.

Thank you in advance.

On Apr 22, 6:02 am, reekotubbs <reekotu...@gmail.com> wrote:
> Hello all,
>
> I have a OutGoingCallReceiver setup to catch outgoing calls, it
> attempts to check their group membership and return which groups the
> contacts are part of.
>
> I have been using 1.5 code to accomplish this on the emulator. It
> works for users I create, because I have to add them to the groups I
> am looking for, but when I do this on a live android phone with gmail
> synced, it does not pull back group membership. Any help on this.
>
> here is some of the code:
>
>                 d =
> context.getContentResolver().query(Contacts.GroupMembership.CONTENT_URI,
> projection2,
>                        filterString2,null, null);
>                 if(d.moveToFirst()){
>                 String notes2 =
> c.getString(c.getColumnIndex(Contacts.GroupMembership.PERSON_ID));
>                 sGroupName =
> d.getString(d.getColumnIndex(Contacts.GroupMembership.NAME));
>                 return (sGroupName);
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment