Cache google maps on ionic2 app?

Hi all,

I’m using ionic and the google maps javascript api to display a map which will always be showing the same area. Its quite small 10 miles by 10 miles so is it possible to cache it on the client to stop them requesting the same thing over and over again?

Thanks!

There used to be a static map option that might be the solution you are looking for. Google Maps aren’t cacheable per the license.

use native map plugin instead i think

The review on this page of native vs javascript says the native one has issues especially when using multiple screens over the map.

But if it allows caching it will be worth considering it again.

EDIT: just found this post which somewhat solves the issue mentioned in the review. I will test them out to make sure it works.

javascript map is downloading bunch of png file everytime you zoom and move…native map is only download the data and draw locally…i think it would save you a lot of data usage by using native

1 Like

Also, when it says google maps ‘native’ there are two types one for IOS and one for android.

As you can see here https://developers.google.com/maps/

So would you have to make a different map for each device, which is against the point of a hybrid app?

thanks

you use the ionic-native plugin…it will handle for you

I see. And last question - I’m using ubuntu, how easywould it be to create the application without an ios simulator (btw I have access to a mac for compiling and publishing to appstore) but can you reliably test it using chrome dev tools and select view in iphone for example?

thanks!

hmm…if you are going to use native plugin mostly you need to have a physical device to test and debug… for example if you are using google map usually you will need Geolocation to get your current position…if you are going to build and test ui and other part you just need to run “ionic serve --lab” and in chrome it will have 3 view which is Android, IOS, and windows.usually i always use ionic serve to develop and testing…only build to device to test native plugin

1 Like

I can use an iphone to test it, would ionic view app be the way to test the build for native plugins?

i never use ionic view before but i think it would be the only option to test on iphone if you not using a mac

1 Like