入门Android的用户名存储在手机 [英] Getting the android username stored in the phone

查看:105
本文介绍了入门Android的用户名存储在手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写信,要求取回从手机android的用户名username@gmail.com的应用程序。我一直在寻找的AccountManager类。这就是我现在在我的code。

I am writing an application that requires to retrieve the android username username@gmail.com from the phone. I have been looking at AccountManager class. This is what I have for now in my code.

    AccountManager accountManager = AccountManager.get(this);

    Account[] accounts =
    accountManager.getAccountsByType("com.google");

    String email="";
    email=accountManager.getUserData(accounts[0], accountManager.KEY_USERDATA);

不过,我得到一个来电UID 10085比认证的uid例外不同。 任何人都知道该怎么办呢?

However, I am getting a caller uid 10085 is different than the authenticator's uid exception. Anyone knows how to do it?

PS。我不需要密码或身份验证令牌,我只需要用户名。

PS. I don't need password or authentication token, I just need the username.

推荐答案

用户名是提供给您;只需使用:

Username is available to you; just use:

字符串email =应收[0]。名称;

这篇关于入门Android的用户名存储在手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆