android – 谷歌登录不显示具有单个谷歌帐户的设备的帐户选择器
作者:互联网
我正在尝试为Android应用程序实施谷歌加登录.我按照谷歌开发者页面“https://developers.google.com/+/mobile/android/getting-started”上的指南进行操作.我唯一的问题是,当设备上只有一个Google帐户时,帐户选择器对话框不会显示.有没有解决的办法?
解决方法:
我使用了@acj建议的AccountPicker.我启动了AccountPicker意图
Intent intent = AccountPicker.newChooseAccountIntent(null, null,
new String[] { "com.google" }, true, null, null, null,
null);
startActivityForResult(intent, ACCOUNT_PICKER_REQUEST_CODE);
当结果返回时,我初始化GoogleApiClient,按照开发者页面上的说明设置accountName:
GoogleApiClient client = new GoogleApiClient.Builder(this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.setAccountName("users.account.name@gmail.com")
.build();
client.connect();
@dcool,希望这会有所帮助.
标签:android,google-login,google-plus 来源: https://codeday.me/bug/20190831/1775948.html