thank you very much :D On Thu, May 27, 2010 at 4:36 PM, ayanir <[email protected]> wrote:
> I think I found it. > the original post is from: > > http://groups.google.com/group/android-developers/browse_thread/thread/7a6bf77910ca31e0/7a7659d61a89fa41?lnk=gst&q=how+can+I+get+the+Google+account+or+Gmail+address+from+the+phone#7a7659d61a89fa41 > > > 1. download the framework.jar from: > > http://github.com/android/platform_frameworks_opt_com.google.android/blob/7e12826d58454d3bade238e3b2c43fe402278f19/framework.jar > > and add it to you build path. this is some sort of an interface to the > Google device functions. > > 2. call the method: > > com.google.android.googlelogin.GoogleLoginServiceHelper.getAccount(Activity > activity, int requestCode, boolean requireGoogle); > where: > Activity: is your Activity which get the result in the > onActivityResult() > requestCode: your code > requireGoogle: should be true > EX. GoogleLoginServiceHelper.getAccount(mActivity, 123, true); > > 3. override the onActivityResult() like: > protected void onActivityResult(int requestCode, int resultCode, > Intent data) { > super.onActivityResult(requestCode, resultCode, data); > > if(requestCode == 123){ > System.out.println(resultCode); > String key = "accounts"; > System.out.println(key + ":" + > Arrays.toString(data.getExtras().getStringArray(key))); > String accounts[] = data.getExtras().getStringArray(key); > if(accounts != null){ > int i = 0; > for(String ac : accounts){ //each account is the full > email address registered with this device > System.out.println("ac " + i + "=" + ac); > i++; > } > } > } > > 4. add in the AndroidManifest.xml the following permition: > <uses-permission > > android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"></ > uses-permission> > > 5. your done! > > enjoy > > On May 27, 10:52 am, Jose Luis Montes <[email protected]> wrote: > > I was looking for this issue too. The diference is that i need to get > > username (gmail address) and password, or google credentials. > > > > I need this to use google calendar api, but gdata lib version 1 is > android > > not compatible and version 2 (which is android compatible) is api level 5 > or > > higher and i am developing for api level 3 too. > > > > regards! > > > > On Thu, May 27, 2010 at 9:37 AM, ayanir <[email protected]> wrote: > > > Hello, > > > > > I was looking for this info all over and still haven't found an > > > answer. > > > Is there a way to get the Google account or the Gmail address (no > > > password) which have been signed to the device. > > > the closest thing I saw is using AccountManager and Acount but this is > > > only for Android class 5 or higher and I'm developing for class 3. > > > from my understanding this is for online services which I do not need > > > - I'm only want the Gmail address. > > > > > Thanks > > > ayanir > > > > > -- > > > 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]<android-developers%[email protected]> > <android-developers%[email protected]<android-developers%[email protected]> > > > > > 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > 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 [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

