android – 如何获得用户的谷歌市场账户?

如何从代码中获取用户的市场帐户,即他们在Google市场中安装应用程序的帐户? 最佳答案 如果您正在寻找设备的已配置电子邮件ID,这将对您有所帮助.

    Account[] accounts = AccountManager.get(ContactUs.this).getAccounts();
    for (Account account : accounts) {
      // TODO: Check possibleEmail against an email regex or treat
      // account.name as an email address only for certain account.type values.
      String possibleEmail = account.name;
     Log.i("Email ID",possibleEmail);

    }
点赞