android - How to get primary email address on 1.6? -
is there way primary email address on android 1.6 ? if yes, please suggest me.
thank in advance.
see sohilv's answer this question.he says:
download framework.jar from: http://github.com/android/platform_frameworks_opt_com.google.android/... , add build path. sort of interface google device functions. call method:
com.google.android.googlelogin.googleloginservicehelper.getaccount(activity activity, int requestcode, boolean requiregoogle);
where: activity: activity result in onactivityresult() requestcode: code requiregoogle: should true
ex. googleloginservicehelper.getaccount(mactivity, 123, true);
3.override 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 = 0; for(string ac : accounts){ //each account full email address registered device system.out.println("ac " + + "=" + ac); i++; } } }
original post here
Comments
Post a Comment