I'm trying to do the same thing. Did you manage to fix this?

Cheers,

Jodi

On Aug 13, 4:06 pm, "Jonas Petersson" <[email protected]> wrote:
> Dear experts,
>
> I've attempted to implement what Jeff describes below on 1.1 as well as
> 1.5 (both real device and emulated), but as far as I can tell it never
> succeeds. I have the permission to read contact data (otherwise I get an
> exception). Maybe I've made some very basic mistake.
>
> Has anyone got a code snippet that succeeds with this?
>
> I know that for instance Nav4All successfully sends my google mail
> address to the server (via the web browser so it is not too hard to
> spot) each time I upgrade, so obviously there is SOME way of
> extracting this.
>
> Any advice would be appreciated.
>
> Here is my code snippet that never succeeds:
>
>        Uri contactUri =
> Uri.withAppendedPath(Contacts.People.CONTENT_URI, "owner");
>        ContentResolver resolver = getContentResolver();
>
>        Cursor c = resolver.query(contactUri, null, null, null, null);
>        if (!c.moveToFirst()) {  // This always happens
>                c.close();
>               return;
>        }
>        // Extract the data - never gets here
>
> I've also tried only extracting the id, but with the same result. I've
> tried to decipher
> packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider.java
> and as far as I can tell it SHOULD end up in queryOwner(), pick up the
> PREF_OWNER_ID and query for that id, but I sure seem to fail every time.
>
> It is hardly a critical function, but it is annoying that I can't get it
> to work...
>
>                             Best  / Jonas
>
> On Thu, May 14, 2009 at 23:01, Jeff Sharkey<[email protected]> wrote:
>
>  > Although not officially supported, you might try getting theowner's
>  > contact details:
>  >
>  > Uri.withAppendedPath(Contacts.People.CONTENT_URI, "owner");
>  >
>  > And you'll need to ask for the "android.permission.READ_OWNER_DATA"
>  > permission to readownerdata.  Like I said, it's not part of the
>  > published Contacts API, and it might disappear in a future release.
>  >
>  > You probably want to avoid asking for a sensitive permission like
>  > this, especially when it's just being used for pre-filling a form.
>  > Users will see that you're requesting their personal contact
>  >informationwhen installing your app, and they will probably cancel
>  > the installation.
>  >
>  > j
>  > On Thu, May 14, 2009 at 11:28 AM, Anna PS > 
> <[email protected]> wrote:
>
> - Hide quoted text -
>  >> I'd like to retrieve the user's own email address, as configured in
>  >> their Gmail application (purpose: just so I can pre-fill a form field
>  >> for 'Your email').
>  >>
>  >> Is this possible in Android, maybe through one of the
>  >> ContentProviders, or would it breach privacy in some way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to