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:
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:
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)
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.
> 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:
> 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:
> 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)
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.
> > 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:
> > 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:
> > 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)
> 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.
> > > 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:
> > > 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:
> > > 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)
The original, public "android.provider.Contacts" APIs that has shipped
since Android 1.0 are still very much supported, but are now marked as
deprecated. There are additional features (like multiple accounts)
that will require upgrading to the new
"android.provider.ContactsContract" APIs to access. For example, only
data from the primary account is exposed through the now-legacy
"android.provider.Contacts" APIs.
> 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.
>> > 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:
>> > 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:
>> > 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)
> The original, public "android.provider.Contacts" APIs that has shipped
> since Android 1.0 are still very much supported, but are now marked as
> deprecated. There are additional features (like multiple accounts)
> that will require upgrading to the new
> "android.provider.ContactsContract" APIs to access. For example, only
> data from the primary account is exposed through the now-legacy
> "android.provider.Contacts" APIs.
> > 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.
> >> > 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:
> >> > 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:
> >> > 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
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
> 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.
> > > 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:
> > > 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:
> > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en > -~----------~----~----~----~------~----~------~--~---
That sucks - Is this going to be trend with Android ? I would rather
not put lot of effort every time google comes up with an update, so
far I had to touch/test my apps several times just in few months..
1.0 / 1.1 / 1.5 / 1.6
Now 2.0 Breaks every thing. It's not like any one in the app market
are making money it's for passion and you are making it very difficult
to pursue that.
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
> > > > 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:
> > > > 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:
> > > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en > > -~----------~----~----~----~------~----~------~--~---
And the worst part is if we use 2.0 API's to have clean code, now i
have to maintain 2 version of the same code base - being from SW
company you should know how difficult it would be. Very disappointing.
On Nov 6, 8:31 pm, Ravi <textlo...@gmail.com> wrote:
> That sucks - Is this going to be trend with Android ? I would rather
> not put lot of effort every time google comes up with an update, so
> far I had to touch/test my apps several times just in few months..
> 1.0 / 1.1 / 1.5 / 1.6
> Now 2.0 Breaks every thing. It's not like any one in the app market
> are making money it's for passion and you are making it very difficult
> to pursue that.
> 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.
> > > > 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
> > > > > 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:
> > > > > 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:
> > > > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en > > > -~----------~----~----~----~------~----~------~--~---
On Sat, Nov 7, 2009 at 10:31 AM, Ravi <textlo...@gmail.com> wrote:
> That sucks - Is this going to be trend with Android ? I would rather
> not put lot of effort every time google comes up with an update, so
> far I had to touch/test my apps several times just in few months..
> 1.0 / 1.1 / 1.5 / 1.6
> Now 2.0 Breaks every thing. It's not like any one in the app market
> are making money it's for passion and you are making it very difficult
> to pursue that.
Exactly. Especiall account setting doesn't work in emulator, which means
I have to buy a device for 2.0 development. It's difficult for an author of
free software.
> 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.
> > > > 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
> > > > > 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:
> > > > > 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:
> > > > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> <android-developers%2Bunsubscribe@googlegroups.com<android-developers%252Bu nsubscribe@googlegroups.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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
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
> > > > 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:
> > > > 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:
> > > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en > > -~----------~----~----~----~------~----~------~--~---
On Fri, Nov 6, 2009 at 6:31 PM, Ravi <textlo...@gmail.com> wrote:
> Now 2.0 Breaks every thing.
Wow that's pretty over-the-top. The original contacts API still works, as
long as you weren't using private parts of it, and only for the primary
Google account. So it still gives you the same functionality (the new
feature of additional accounts is not accessible from it, but that is why a
new API was required) as before. And as we've said repeatedly for
everything, if you use private APIs you will break in the future, so that
shouldn't be a surprise.
Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. All such
questions should be posted on public forums, where I and others can see and
answer them.
> On Fri, Nov 6, 2009 at 6:31 PM, Ravi <textlo...@gmail.com> wrote:
> > Now 2.0 Breaks every thing.
> Wow that's pretty over-the-top. The original contacts API still works, as
> long as you weren't using private parts of it, and only for the primary
> Google account. So it still gives you the same functionality (the new
> feature of additional accounts is not accessible from it, but that is why a
> new API was required) as before. And as we've said repeatedly for
> everything, if you use private APIs you will break in the future, so that
> shouldn't be a surprise.
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails. All such
> questions should be posted on public forums, where I and others can see and
> answer them.
Both Wow! and over-the-top. Now I am excited. This pattern/technique
was lifted from a distinguished Android pro's recent textbook. So
does the wow imply there is a better way to accomplish the mission? I
think I considered the contact PICK Intent, but I need to allow the
user to select multiples. If you can advise a "published" way to pull
this off across the a- versions, I may just buy you a lovely beverage!
Peace,
Scott
On Nov 17, 2:31 pm, Dianne Hackborn <hack...@android.com> wrote:
> On Fri, Nov 6, 2009 at 6:31 PM, Ravi <textlo...@gmail.com> wrote:
> > Now 2.0 Breaks every thing.
> Wow that's pretty over-the-top. The original contacts API still works, as
> long as you weren't using private parts of it, and only for the primary
> Google account. So it still gives you the same functionality (the new
> feature of additional accounts is not accessible from it, but that is why a
> new API was required) as before. And as we've said repeatedly for
> everything, if you use private APIs you will break in the future, so that
> shouldn't be a surprise.
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails. All such
> questions should be posted on public forums, where I and others can see and
> answer them.
> On Fri, Nov 6, 2009 at 6:31 PM, Ravi <textlo...@gmail.com> wrote:
> > Now 2.0 Breaks every thing.
> Wow that's pretty over-the-top. The original contacts API still works, as
> long as you weren't using private parts of it, and only for the primary
> Google account. So it still gives you the same functionality (the new
> feature of additional accounts is not accessible from it, but that is why a
> new API was required) as before. And as we've said repeatedly for
> everything, if you use private APIs you will break in the future, so that
> shouldn't be a surprise.
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails. All such
> questions should be posted on public forums, where I and others can see and
> answer them.
It is good if you change API to make it more featureful though having
a documentation with a working example for this use case would be
really helpful.
Best,
Lukasz
On Nov 18, 7:30 am, Bonifaz <bonifaz.kaufm...@gmail.com> wrote:
> How do we then get all contacts/phonenumbers from all accounts?
> If I use the new Contacts API and send an ACTION.PICK for phone
> numbers like
> Intent i = new Intent(Intent.ACTION_PICK,
> android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
> it doesn't give me for example Facebook account phone numbers.
> even
> Intent i = new Intent(Intent.ACTION_PICK,
> android.provider.ContactsContract.Contacts.CONTENT_URI);
> doesn't show a list of all available contacts from all accounts (again
> I tried with Facebook contacts and they didn't show up).
> Dianne, could you please tell us how we use the PICK intent to get a
> list of all available phone numbers from all accounts.
> This would be really helpful.
> On Nov 17, 3:31 pm, Dianne Hackborn <hack...@android.com> wrote:
> > On Fri, Nov 6, 2009 at 6:31 PM, Ravi <textlo...@gmail.com> wrote:
> > > Now 2.0 Breaks every thing.
> > Wow that's pretty over-the-top. The original contacts API still works, as
> > long as you weren't using private parts of it, and only for the primary
> > Google account. So it still gives you the same functionality (the new
> > feature of additional accounts is not accessible from it, but that is why a
> > new API was required) as before. And as we've said repeatedly for
> > everything, if you use private APIs you will break in the future, so that
> > shouldn't be a surprise.
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails. All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.
I still don't know how to query Facebook contacts and their phone
numbers.
Could please someone give me a hint about this. If I query
Contacts.CONTENT_URI, it returns all contacts but not Facebook
contacts.
Just to clarify the Facebook question: the FB contact data is not visible to
any applications except a handful of built-in apps like Contacts. That's a
policy decision by Facebook.
At the same time, any application can read and write data from all other
types of accounts, including Google and Exchange (aka Corporate)
Thanks,
Dmitri
On Dec 1, 2009 9:31 PM, "Bonifaz" <bonifaz.kaufm...@gmail.com> wrote:
I still don't know how to query Facebook contacts and their phone
numbers.
Could please someone give me a hint about this. If I query
Contacts.CONTENT_URI, it returns all contacts but not Facebook
contacts.
-- You received this message because you are subscribed to the Google Groups
"Android Developers" ...
> Just to clarify the Facebook question: the FB contact data is not visible to
> any applications except a handful of built-in apps like Contacts. That's a
> policy decision by Facebook.
> At the same time, any application can read and write data from all other
> types of accounts, including Google and Exchange (aka Corporate)
> Thanks,
> Dmitri
> On Dec 1, 2009 9:31 PM, "Bonifaz" <bonifaz.kaufm...@gmail.com> wrote:
> I still don't know how to query Facebook contacts and their phone
> numbers.
> Could please someone give me a hint about this. If I query
> Contacts.CONTENT_URI, it returns all contacts but not Facebook
> contacts.
> -- You received this message because you are subscribed to the Google Groups
> "Android Developers" ...
> On Dec 2, 12:41 am, Dmitri Plotnikov <dplotni...@google.com> wrote:
> > Just to clarify the Facebook question: the FB contact data is not visible to
> > any applications except a handful of built-in apps like Contacts. That's a
> > policy decision by Facebook.
> > At the same time, any application can read and write data from all other
> > types of accounts, including Google and Exchange (aka Corporate)
> > Thanks,
> > Dmitri
> > On Dec 1, 2009 9:31 PM, "Bonifaz" <bonifaz.kaufm...@gmail.com> wrote:
> > I still don't know how to query Facebook contacts and their phone
> > numbers.
> > Could please someone give me a hint about this. If I query
> > Contacts.CONTENT_URI, it returns all contacts but not Facebook
> > contacts.
> > -- You received this message because you are subscribed to the Google Groups
> > "Android Developers" ...
> Just to clarify the Facebook question: the FB contact data is not visible to
> any applications except a handful of built-in apps like Contacts. That's a
> policy decision by Facebook.
> At the same time, any application can read and write data from all other
> types of accounts, including Google and Exchange (aka Corporate)
> Thanks,
> Dmitri
> On Dec 1, 2009 9:31 PM, "Bonifaz" <bonifaz.kaufm...@gmail.com> wrote:
> I still don't know how to query Facebook contacts and their phone
> numbers.
> Could please someone give me a hint about this. If I query
> Contacts.CONTENT_URI, it returns all contacts but not Facebook
> contacts.
> -- You received this message because you are subscribed to the Google Groups
> "Android Developers" ...
> My app *is* reading FB names/numbers! Is this an indirect feature on
> account of them being imported/sync'd?
> Peace,
> Scott
> On Dec 1, 11:41 pm, Dmitri Plotnikov <dplotni...@google.com> wrote:
> > Just to clarify the Facebook question: the FB contact data is not visible to
> > any applications except a handful of built-in apps like Contacts. That's a
> > policy decision by Facebook.
> > At the same time, any application can read and write data from all other
> > types of accounts, including Google and Exchange (aka Corporate)
> > Thanks,
> > Dmitri
> > On Dec 1, 2009 9:31 PM, "Bonifaz" <bonifaz.kaufm...@gmail.com> wrote:
> > I still don't know how to query Facebook contacts and their phone
> > numbers.
> > Could please someone give me a hint about this. If I query
> > Contacts.CONTENT_URI, it returns all contacts but not Facebook
> > contacts.
> > -- You received this message because you are subscribed to the Google Groups
> > "Android Developers" ...
Hi Dmitri -- I am not sure that the old API is still functional. I am
using what I think is the standard way of getting a display name from
a phone number -- see the code below -- and it functions on a 1.6
emulator but on on a 2.0 emulator. Am I doing something wrong? Is
there an example somewhere of how to "get a contact name from a phone
number" that will function in 1.5, 1.6, and 2.0?
Here's the code -- it works when run in the 1.6 emulator, but not in
the 2.0 emulator (Cursor comes back non-null, but there are no records
so moveToFirst returns false):
public String getDisplayName (ContentResolver contentResolver)
{
String retval = mPhoneNumber;
> 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
> > > > 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:
> > > > 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:
> > > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en > > -~----------~----~----~----~------~----~------~--~---
On Fri, Dec 4, 2009 at 4:00 PM, ghassett <greghass...@gmail.com> wrote:
> Hi Dmitri -- I am not sure that the old API is still functional. I am
> using what I think is the standard way of getting a display name from
> a phone number -- see the code below -- and it functions on a 1.6
> emulator but on on a 2.0 emulator. Am I doing something wrong? Is
> there an example somewhere of how to "get a contact name from a phone
> number" that will function in 1.5, 1.6, and 2.0?
> Here's the code -- it works when run in the 1.6 emulator, but not in
> the 2.0 emulator (Cursor comes back non-null, but there are no records
> so moveToFirst returns false):
> On Oct 30, 3: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
>> > > > 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:
>> > > > 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:
>> > > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@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+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
Yes Dmitri, this is exactly what I am doing -- I am not manually
inserting records into the contacts db like the test case does, but
there is definitely a contact with a mobile phone number
"617939xxxx" (with real digits, not "x"s), and when I open a cursor on
the query:
Uri filterUri1 = Uri.withAppendedPath(Phones.CONTENT_FILTER_URL,
"617939xxxx"); // with real digits, not "x"s
I get back a valid cursor, but no rows (moveToFirst() returns false)
-- on 2.0 emulator only. On 1.6 emulator, it works fine.
// greg //
On Dec 4, 7:21 pm, Dmitri Plotnikov <dplotni...@google.com> wrote:
> Is what it's doing correct? Is it different from what you are doing?
> Thank you,
> - Dmitri
> On Fri, Dec 4, 2009 at 4:00 PM, ghassett <greghass...@gmail.com> wrote:
> > Hi Dmitri -- I am not sure that the old API is still functional. I am
> > using what I think is the standard way of getting a display name from
> > a phone number -- see the code below -- and it functions on a 1.6
> > emulator but on on a 2.0 emulator. Am I doing something wrong? Is
> > there an example somewhere of how to "get a contact name from a phone
> > number" that will function in 1.5, 1.6, and 2.0?
> > Here's the code -- it works when run in the 1.6 emulator, but not in
> > the 2.0 emulator (Cursor comes back non-null, but there are no records
> > so moveToFirst returns false):
> > On Oct 30, 3: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.
> >> > > 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
> >> > > > 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:
> >> > > > 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:
> >> > > > 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+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@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+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en