Ionic maps template does not work on device


#1

I just created a new project with the maps template (ionic start MyMap maps). It runs fine with ionic serve (opening it with the browser), but if I run it in the emulator or in a device, google map does not load. No error message is show. What could I do to make it work across all environments?


#2

Thanks for the pointer to the maps template.
On my Android device its working - the map is shown. You need to have an internet connection in your device or emulator otherwise the request to https://maps.googleapis.com/maps/api/js will fail and map will not be shown.

However it fails to center the map to my current position. When you debug using chrome remote debugger you notice the following error:

device plugin required
ionic.Platform.device @ ionic.bundle.js:2020

Add the plugin:
ionic plugin add https://github.com/apache/cordova-plugin-device.git

After that still no current location, you will need another plugin, geolocation:
ionic plugin add https://github.com/apache/cordova-plugin-geolocation.git

(see https://github.com/driftyco/ionic-starter-maps/issues/3#issuecomment-69977414)

Hope this helps.