Cannot get google maps demo to work

Hi!

I'm trying to get MapsAndLocationDemo_v3 working without much luck from Xamarin.Android (version 4.8 I think (just installed)) and Visual Studio 2012.

I have managed to obtain a key for "Google Maps Android API v2" and entered the key in the android manifest-file and updated the name of the package and permission android:name, but that's about it.

  • SimpleMapDemo says that GooglePlayServices is not available (SERVICE_INVALID)

  • SimpleMapDemo_Froyo gives me an error "Android.Content.ActivityNotFoundException: Loading..."

This is tested on a ADV targeting API Level 17 (Intel Atom x86).

I have made sure that Google Play Services rev 10 is installed (and I'm using googleplayservicesfroyo10).

When I test on a real device (SimpleMapDemo_Froyo) running Android 2.3.3 I get blank pages for the demos (except the "Show Maps App").

Thank you for helping,

/Erik

Posts

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai

    Try on an actual device.

    There is known issue with the emulator images: the version of Google Play installed is to old and won't work.

  • ErikFAndersenErikFAndersen DKMember ✭✭

    On a real device only blank pages show up.

  • rlangtonrlangton USMember ✭✭
    edited August 2013

    Blank pages usually indicate a problem with permissions. Verify you have the following in your AndroidManifest.xml (replace com.example.mapdemo with your app name):

    <permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/>

    and

    <!-- We need to be able to download map tiles and access Google Play Services--> <uses-permission android:name="android.permission.INTERNET" /> <!-- Allow the application to access Google web-based services. --> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <!-- Google Maps for Android v2 will cache map tiles on external storage --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- Google Maps for Android v2 needs this permission so that it may check the connection state as it must download data --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- These are optional, but recommended. They will allow Maps to use the My Location provider. --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    I've noticed that changing stuff on the Xamarin property page will sometimes mess up these permissions and my maps will start showing up blank.

  • ErikFAndersenErikFAndersen DKMember ✭✭

    Thanks, I was missing some permissions and now it works on the device :-)

    It would appear some of these settings is missing in the demo.

    I would love however to get it working in the emulator as well. I tried with 4.3 emulator (API 18, Intel x86 image) and now I get the error message:

    • Google Play Store is missing

    Is there any way to install this app in an emulator (I'm running Windows 7)?

    Regards,
    Erik

  • StevenTheEvenStevenTheEven SEMember ✭✭✭

    http://forums.xamarin.com/discussion/comment/25324/#Comment_25324
    So install a never version of google play in the emulator. How? I don't know. Can it be done? I don't know.

  • stevenferrellstevenferrell USMember

    Is there an ETA on a fix for this working with the emulators? Is it out of your hands? I don't have a device to test on at the moment so I'm out of luck?

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    The emulator issue is a Google deal. As stated in their documentation:

    http://developer.android.com/google/play-services/setup.html

    To test your app when using the Google Play services SDK, you must use either:
       * A compatible Android device that runs Android 2.2 or higher and includes Google Play Store.
       * The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.
    
    Ideally, you should develop and test your app on a variety of devices, including both phones and tablets.
    
  • stevenferrellstevenferrell USMember
    edited August 2013

    OK- that's what I thought.

    How is google with fixing stuff like this? Has this problem been around for a while? Can we expect them to fix it soon? etc etc.. glad it's not just me at least :X

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    Well, you can run it on an emulator with Android 4.2.2 and above (offically). Anything below 4.2.2 is not "officially supported". However, there are people out in the interwebs who may have been able to hack some stuff together to get it to work.

    http://nemanjakovacevic.net/blog/english/2012/12/06/how-to-make-android-google-maps-v2-work-in-android-emulator/

    That may be a start and you can go from there.

    I wouldn't hold my breathe waiting for Google.

    On another note, I rarely use emulators for development. Have always used real devices, and I usually pick up older devices from friends/family that have upgraded their phones. Anywhere from free to <$100. Especially if they have cracked screens, but are still functional. I've built up quite a collection.

  • stevenferrellstevenferrell USMember
    edited August 2013

    Really, 4.2.2+ emulation using google play services / v2 maps works for you? I get the error that topgenorth is talking about.

    Emulator.. Target Name Google APIs (Google Inc), Platform 4.3, API Level 18

    It 'worked' while I had no V2 maps key registered, but I got a blank map of course. Once I added a key, I got the following error,

    [GooglePlayServicesUtil] Google Play services out of date.  Requires 3225100 but found 3158130
    
    
     [XamarinMapDemo] There is a problem with Google Play Services on this device: 2 - SERVICE_VERSION_UPDATE_REQUIRED
    

    I've seen the work-arounds for this like you linked, but unless it's official I don't think I want to screw with anything. Especially considering the comments that guy is seeing regarding it not working for a lot of people...

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai

    @stevenferrell The emulator issue is totally in Google's hands, there's not much Xamarin can do about it. I'd strongly encourage you to get an Android device if you're going to be doing serious development with Google Maps v2. If you have to go the emulator route, there are two options for you:

    • If you search the internet, you will find directions on how to manually install Google Play Services in an emulator.
    • You might try GenyMotion's emulators - odds are they have a more up to date version of Google Play installed.
Sign In or Register to comment.