如何获得主电子邮件地址1.6?如何获得、电子邮件地址

2023-09-03 20:49:39 作者:认识的人越多ωǒ越喜欢狗

有没有办法让在Android 1.6的主要电子邮件地址? 如果是的话,请给我建议。

Is there a way to get primary email address on Android 1.6 ? If yes, please suggest me.

感谢提前。

推荐答案

请参阅sohilv的回答this 。他的问题说: http://github.com/android/platform_frameworks_opt_com.google.android:从下载framework.jar / ......并把它添加到您构建路径。这是某种接口到谷歌设备功能的。 调用方法:

See sohilv's answer to this question.He says: download the framework.jar from: http://github.com/android/platform_frameworks_opt_com.google.android/... and add it to you build path. this is some sort of an interface to the Google device functions. call the method:

com.google.android.googlelogin.GoogleLoginServiceHelper.getAccount(活动活动,诠释请求code,布尔requireGoogle);

com.google.android.googlelogin.GoogleLoginServiceHelper.getAccount(Activity activity, int requestCode, boolean requireGoogle);

其中:活动:为您的活动当中去,在onActivityResult()的结果要求code:你的code 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,真);

EX. GoogleLoginServiceHelper.getAccount(mActivity, 123, true);

3.override的onActivityResult()这样的:

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++; 
                   } 
                } 
       } 

原帖是在这里

original post is here