入门Android的用户名存储在手机入门、用户名、手机、Android

2023-09-05 06:53:36 作者:逍遥

我写信,要求取回从手机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]。名称;

 
精彩推荐
图片推荐