3

I have caching enabled in my SupportMapFragment created with the Android Google Maps API v2. I'd like to be able to programmatically clear the cache of my program within the application itself, a requirement being levied on me. I am doing this using the trimCache() method described here by crony_cd.

When I execute this method though, it only seems to be deleting a small piece of the cache, presumably the cache files that my own application is creating, not the cache files created by the Google Maps API. Is it possible to wipe the cache that the Maps API produces?

Community
  • 1
  • 1
Stealth Rabbi
  • 10,156
  • 22
  • 100
  • 176

2 Answers2

1

As far as I know no. The cache is controlled by Googles maps library on a project to project basis. That means tiles are cached for each app using maps. When you've decided to use Googles Maps library you'll also have to live with this, trying to remove these files or doing something with reflection will only possibly break your app with future updates of Google services.

Warpzit
  • 27,966
  • 19
  • 103
  • 155
  • That's what I was thinking. But I find it curious that the screen in the App Settinsg that lets you force close, clear data, and clear cache reflects the cached map tiles in the cache size total, as if it IS part of the app. – Stealth Rabbi Feb 08 '13 at 12:48
  • @StealthRabbi When I look in the folder (sd/android/data/projectname/cache/) I find a bunch of files lying in there which I'm pretty sure I didn't put there :) I think these files work like links to the "real" cache. – Warpzit Feb 08 '13 at 13:02
  • Did any one got answer for this? – JAPS May 30 '14 at 13:14
  • @JalpaShah Updated answer, but I guess the auther left it. – Warpzit May 30 '14 at 13:26
0

This is the same for me: my cache contains new files and one of its files has a size of 2.2M (and it can go until 20-30M.)...Those files appear only when I open the map activity.

So I guess that this is the cache map. But to my opinion, due to the size, it is not a link...

I do not have any idea for the moment on the way to manage this cache. I think it is not our job...

AntoineP
  • 3,035
  • 1
  • 19
  • 22