简体   繁体   English

登录后显示google +用户名

[英]Displaying google+ username after sign-in

I followed Google's tutorial on implementing the google+ api but it doesn't say anything about that dialog with the user's name that shows up at the top of your screen after signing in to your google+ account like many other games have. 我按照Google的有关实现google + api的教程进行操作,但与其他许多游戏一样,登录到google +帐户后,该对话框没有显示用户名,该用户名显示在屏幕顶部。 I can't find any information about different layouts either, like the loading screen that shows up sometimes after you've pressed sign-in. 我也找不到有关不同布局的任何信息,例如按登录后有时会显示加载屏幕。

You can use the API to request the users profile: 您可以使用API​​来请求用户个人资料:

Person me = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
if (me != null) {
    //me.getDisplayName();
}

It seems like what is displayed during the login process really depends on the speed of the device, the load on the device, and perhaps the network connection. 似乎在登录过程中显示的内容实际上取决于设备的速度,设备的负载以及可能的网络连接。 In my case, most of the time the activity starts and disappears before I have a chance to read what it says (when user has already been authorized). 就我而言,在大多数情况下,活动开始并消失之前,我才有机会阅读其内容(当用户已获得授权时)。

I think you can always count on your activity being paused then resumed if you call mGoogleApiClient.connect() when !mGoogleApiClient.isConnected(). 我认为,如果您在!mGoogleApiClient.isConnected()时调用mGoogleApiClient.connect(),那么您总是可以指望自己的活动被暂停然后再恢复。 I do not believe you can brand their Activity other than with your application logo. 我相信除了使用您的应用程序徽标之外,您不能为他们的活动打上烙印。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM