• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to fetch account information from google using authentication token

shri_r

Lurker
Hi...

I am new to android.. Actually i am working on getting google account information of the user, i got authentication token, using that how to get user account informations like calender data,location and others???..Thanks in advance :)

shri here..
 
Thanks for your advice...

actually i written these lines of code's to get authentication token, (i added gmail accounts already in the emulator phone , using add account option in account and sync). And i am getting authentication token value in the form of string ..strToken .


AccountManager mgr = AccountManager.get(this);
Account accts[] = mgr.getAccountsByType("com.google");
Account acct = accts[0];
AccountManagerFuture<Bundle> accountManagerFuture = mgr.getAuthToken(acct, "ah", null, this, null, null);

authTokenBundle = accountManagerFuture.getResult();
strToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
Log.i("****THE AUTHENTICATION TOKEN IS","Token"+strToken);


String retVal = "";
AccountManager.get(context).invalidateAuthToken("com.google", strToken);
Account accts1[] = mgr.getAccountsByType("com.google");
Account acct1 = accts1[0];
Log.i("value of account AFTER INVALIDATION >>", "rerererer"+acct1);
AccountManagerFuture<Bundle> accFut = AccountManager.get(context).getAuthToken(acct1, "reader", null, this, null, null);
authTokenBundle1 = accFut.getResult();
retVal =(String)authTokenBundle1.get(AccountManager.KEY_AUTHTOKEN);
Log.i("THE VALUE OF THE AUTH TOKEN AFTER VALIDATION", "rerererer"+retVal);



Please tell me how to get account information from using that authentication token..
 
Back
Top Bottom