开发者

Querying Contacts DB w/ multiple synced accounts in Android

My Android app has a ContactsList activity in which I simply display a list of contacts that are on the phone.

Only recently I noticed that my activity only displays contacts synced with my main Google accou开发者_如何学Cnt. I have two Google accounts on my test phone and ideally I want my activity to display the contacts for both accounts (or multiple accounts).

How do I query across multiple accounts?

This is how I setup my cursor currently

Cursor c = getContentResolver().query(Phones.CONTENT_URI, null,
            queryString, null, Phones.DISPLAY_NAME + " ASC");
    startManagingCursor(c);

On a side note, I know android.provider.contacts.phones is deprecated and I should be using ContactsContract but I need to build my app with SDK 1.5, which doesn't have ContactsContract


You can continue to use the deprecated Contacts APIs but they only work with the first Google account assigned to the phone- they will not work with multiple accounts, as noted in the documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜