How to implement google play services using androi

2019-08-30 19:46发布

问题:

I have been trying to implement Google Play services using the steps in https://github.com/xamarin/monodroid-samples/tree/master/MapsAndLocationDemo_v2 and https://github.com/xamarin/monodroid-samples/tree/master/GooglePlayServices

android update project -p "path to project" -t 4 worked

ant debug works, updated project.properties, add Api key

However on build in Xamarin studio 4.0.3 on Mac get this.using Xamarin android 4.6. what package is missing. any advice appreciated. am referencing Mono.android,support.v4

/Users/TheCall/MapView/Components/googleplayservices-9.0/samples/GooglePlayServicesApp/GooglePlayServicesApp/obj/Debug/android/src/mono/com/google/android/gms/appstate/OnSignOutCompleteListenerImplementor.java(34,34): 
Error: package com.google.android.gms.appstate does not exist 

com.google.android.gms.appstate.OnSignOutCompleteListener (GooglePlayServicesApp)

回答1:

I suggest that you should use Google Play Services from http://components.xamarin.com/.

Steps:

  1. Check your Google Play Services API in Android SDK Manager. If it's not rev. 12, update it. If thats not possible then check your revision, and find the appropirate component from Xamarin. They support rev. 9, rev. 10, and rev. 12. If you want to support older devices, download the Froyo version.

  2. Download this component if you are updated to rev. 12: http://components.xamarin.com/view/googleplayservices12/

  3. Unzip it, and reference the downloaded DLL in your project.
  4. Use it like this: http://components.xamarin.com/gettingstarted/googleplayservices12