Cache google maps on ionic2 app?


#1

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!


#2

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.


#3

use native map plugin instead i think


#4

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.


#5

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


#6

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


#7

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


#8

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!


#9

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


#10

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


#11

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