Hey Dmitri -- I have a question regarding the legacy apps only having access to the "primary" account. I am writing an application that interfaces with contacts and started on it before 2.0 was released. I am developing with a Motorola CLIQ running 1.5 and my app works fine. Today, I purchased a Droid (2.0) and after setting it up I installed this 1.5 application, only to find that I have a much larger list of contacts and the names in the list are all blank! The code to read the contacts is as follows:
String[] PROJECTION = new String[] { Contacts.People._ID, Contacts.PeopleColumns.NAME }; Cursor c = managedQuery(Contacts.People.CONTENT_URI, PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER); startManagingCursor(c); adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_multiple_choice, c, new String[] { Contacts.PeopleColumns.NAME }, new int[] { android.R.id.text1 }); return adapter; Can you riddle me this? Since I selected google mail as an already existing source of contacts during the activation, was this somehow designated my "primary" account? I notice this code is not picking up contacts I add by hand to the Droid either. I understand the design challenges with merging many lists, so I won't scream about this to you. However, can you tell me how I would read the contacts under 2.0 and if there is a test I could make in my class to read them the 2.0 way or not? Also, can you tell me how the contact primary key comes into play? I had to create my own SQL database to keep track of my contact related attributes and I am keying on the _id from the contact database. Peace, Scott On Oct 30, 2:05 pm, Dmitri Plotnikov <dplotni...@google.com> wrote: > It's deprecated, not removed. The old API is still functional, but with > restrictions: > > 1. If your app was using something non-public, that part is likely to break. > We tested a bunch of apps on the market against the legacy API - most > worked, but some did not. Those were the cases when the app was using some > knowledge of the undocumented underlying database structure. > 2. Legacy API will only give you access to the "primary" account, i.e. the > first Google account you add to the phone. > > - Dmitri > > On Fri, Oct 30, 2009 at 11:40 AM, nEx.Software <email.nex.softw...@gmail.com > > > wrote: > > > Hold up... I'm confused. Are you saying that Contacts portion of the > > SDK is deprecated? Whatever happened to "stick to the SDK because > > those are stable apis that won't break in future versions"? Very > > disappointing... > > > On Oct 30, 11:12 am, Jeff Sharkey <jshar...@android.com> wrote: > > > Could you post the exact Uri you're passing to query()? As the > > > javadoc describes, you need to append a filter string to the > > > CONTENT_FILTER_URI so it knows what to filter on. > > > > Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, > > phoneNumber); > > > > Also, you might be able to skip your second step, since you can > > > directly ask for the PhoneLookup.DISPLAY_NAME column in the > > > projection. > > > > j > > > > On Fri, Oct 30, 2009 at 8:05 AM, agirardello > > > > <andrea.girarde...@gmail.com> wrote: > > > > > Dear all, > > > > > I'm trying to adapt my application (Personalytics) for the brand new > > > > Android 2.0, however I'm facing an issue while accessing contacts' > > > > phone numbers... > > > > > What I need to do is to retrieve the name associated to a stored > > > > contact based on his/her phone number. At present I'm doing this in > > > > two steps: > > > > 1) from a phone number I get the corresponding ID of the stored > > > > contact (if present) > > > > 2) I retrieve the contact's name based on that ID > > > > > I managed to use the correct CONTENT_URI for reading contacts by using > > > > reflection to be fully compatible with Android 2.0 > > > > (ContactsContract.Contacts.CONTENT_URI) and the previous versions > > > > (People.CONTENT_URI). > > > > > Now I'm trying to do the same for Phones.CONTENT_URI (Android <= 1.6) > > > > and ContactsContract.PhoneLookup.CONTENT_FILTER_URI (Android = 2.0) > > > > which is needed by step 2) mentioned above. But as soon as I try to > > > > get a contentResolver by using > > > > ContactsContract.PhoneLookup.CONTENT_FILTER_URI I get the following > > > > exception: > > > > > java.lang.IllegalArgumentException: Unknown URL > > content://com.android.contacts/phone_lookup > > > > > This looks really strange to me, since it should be correct (it is > > > > part of the official API)! Moreover, I tried to look at the "API > > > > Demos" project, in particular to the classes: > > > > > com.example.android.apis.view.List2 > > > > com.example.android.apis.view.List3 > > > > > which are still using the deprecated People.CONTENT_URI and > > > > Phones.CONTENT_URI and thus no data (i.e. contacts) is loaded (of > > > > course I have sample contacts in the emulator). > > > > > - Do you have any suggestion to solve this problem? > > > > - Or is there another approach I can use to get the name of a contact > > > > based on one of his/her numbers? (This must work on all versions of > > > > Android) > > > > > Thank you!!!!!!!! ;-) > > > > > Andrea > > > > -- > > > Jeff Sharkey > > > jshar...@android.com > > --~--~---------~--~----~------------~-------~--~----~ > > 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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > >http://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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en