适用于 android Xamarin 的 Google 帐户登录集成 [英] Google Account login Integration for android Xamarin
问题描述
我需要将 google 登录集成到 android xamarin 应用程序.通过以下链接中的代码:http://motzcod.es/post/67077106339/google-plus-services-login-and-1-in-xamarin-android
它显示错误连接失败并且缺少 [GooglePlayServicesUtil] Google Play 商店.甚至添加了谷歌播放服务(Froyo)组件.
即使我浏览了以下链接https://developers.google.com/+/mobile/android/sign-在
但这与使用java代码的android eclipse有关.任何人都可以建议我如何在 xamarin 中做到这一点.任何提示/链接表示赞赏.谢谢.
最后我通过对来自 xamarin 论坛和 stackoverflow 的可用代码进行研究得到了一个解决方案.我使用了 OAuth2Authenticator
在谷歌开发者控制台中注册为 web 应用程序而不是已安装的应用程序 (android)* 提供带有有效 url 的重定向 url ("http://abcd.com/xyz.aspx") 应在应用程序代码中使用相同的内容.
身份验证完成后,它将返回 access_token
通过使用 access_token 发出 REST 请求以获取用户完整信息 (https://www.googleapis.com/oauth2/v1/userinfo?access_token=" + accessTokenValue + .)
反序列化 json 响应以获取对象中的信息.
<块引用>
*如果我们在开发者控制台中注册为已安装的应用程序(例如android) 发出 OAuth2Authenticator 请求后,它将显示窗口带有消息 请将此代码开关复制到您的应用程序并将其粘贴到那里 [代码] 手动需要关闭窗口并继续到认证.选择使用此 Web 应用程序类型.
有关更多信息,请参阅.: 通过谷歌帐户集成登录 Xamarin.Android 和Xamarin.iOS
I need to integrate google login to android xamarin application. gone through the code from bellow link: http://motzcod.es/post/67077106339/google-plus-services-login-and-1-in-xamarin-android
it shows the error connection failed and [GooglePlayServicesUtil] Google Play Store is missing. even ofter adding google play service(Froyo) component.
even i gone through the bellow links https://developers.google.com/+/mobile/android/sign-in
Android: Login using google account?
but this is related to android eclipse using java code. can anybody suggest me how to do this in xamarin. any hints/links are appreciated. thank you.
Finally i got a solution by doing the research over the available codes from xamarin forum and stackoverflow. I made use of the OAuth2Authenticator
Register in google developer console as webapplication instead of installed application(android)* provide the redirect url with valid url ("http://abcd.com/xyz.aspx") same should be used in the application code.
On authentication complete it will return access_token
By using the access_token make the REST request to get user complete information (https://www.googleapis.com/oauth2/v1/userinfo?access_token=" + accessTokenValue + ".)
Deserialize the json response to get information in object.
*If we registered in developer console as installed application(like android) after making OAuth2Authenticator request it will show window with message please copy this code switch to your application and paste it there [code] manually need to close the window and proceed to authentication. to get ride of this webapplication type is choosen.
Refer for more info. : Login by google account integration for Xamarin.Android and Xamarin.iOS
这篇关于适用于 android Xamarin 的 Google 帐户登录集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!