Android login in my app with google credentials

前端 未结 1 968
我在风中等你
我在风中等你 2020-12-31 22:33

HI I\'m developing an application in wich I want to permit the user to login to my server with his Google account without asking him the credentials because I know that are

相关标签:
1条回答
  • 2020-12-31 23:14

    Is this what you want?

    List<String> googleAccounts = new ArrayList<String>();
    Account[] accounts = AccountManager.get(this).getAccounts();
    for (Account account : accounts) {
      if (account.type.equals("com.google")) {
        googleAccounts.add(account.name);
      }
    }
    

    You can see a more detailed example in the code of the ChromeToPhone app open-sourced by Google: http://www.google.com/codesearch/p?hl=en#JWblrwroAxw/trunk/android/src/com/google/android/apps/chrometophone/MainActivity.java&l=311

    0 讨论(0)
提交回复
热议问题