3

While the user pan and zoom the map in my android app, google maps (Maps SDK for Android) natively stores tiles in the cache folder for performance reasons. Which allows the user to navigate the map offline, should she revisit the same places again (great!).

Unfortunately, the cache folder -- eventually -- get cleared by the system. Forcing the user to connect to the Internet to get access to the same tiles she used to visit (not great!).

When I list the files in getCacheDir() I get this file: com.google.android.gms.maps.volley Which I assume is the file used by google maps to store tiles. I tried to read it but with no luck.

My question is: Is it possible to copy this cache file to internal app storage? Then when the system clear the cache, the app copies the file back to the cache again?

If not possible, what are my alternatives?

Mozart
  • 735
  • 2
  • 6
  • 10
  • Possible duplicate of [Use google maps offline maps (cache) in Google Maps Android API](https://stackoverflow.com/questions/38169034/use-google-maps-offline-maps-cache-in-google-maps-android-api) – Claudio Apr 29 '19 at 07:51
  • `google-maps-api-3` tag is for the Javascript API. – MrUpsidown Apr 29 '19 at 10:49
  • I just need a way to be able to copy the file already created by Maps SDK for Android to another place before it gets deleted in the cache. Then use the same file for offline mode. The app downloading the tiles by itself is out of the scope of the question. The file is in the app's cache so it should be allowed to access it? Is it not? thanks – Mozart Apr 29 '19 at 11:12

0 Answers0