Google Account login Integration for android Xamarin

Suchith picture Suchith · Aug 27, 2014 · Viewed 9.3k times · Source

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?

Google Login For Android App

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.

Answer

Suchith picture Suchith · Sep 10, 2014

Finally i got a solution by doing the research over the available codes from xamarin forum and stackoverflow. I made use of the OAuth2Authenticator

  1. 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.

  2. On authentication complete it will return access_token

  3. By using the access_token make the REST request to get user complete information (https://www.googleapis.com/oauth2/v1/userinfo?access_token=" + accessTokenValue + “.)

  4. 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