Millenial Media (ads) causing data cache on Android, how do I clear the cache in my code?

2.4k views Asked by At

I recently followed the tutorial posted here: https://stackoverflow.com/questions/4898838/howto-implement-adwhirl-in-an-android-project In order to implement a change in advertising service to 'AdWhirl' (with Millennial Media and AdMob as sub-advertisers).

Since the switch my app (normally 1mb in size) can range in size due to Ad Caching by Millennial Media, it is very persistant. Is there a way to delete the cache my app creates in the onDestroy() or finish() methods?

People are complaining that the app takes up too much space if they don't clear the cache on their own. Is there a way to stop it from caching those images (can't find anything in Millennial Media sdk)?

Suggestions are welcome, thanks in advance!

1

There are 1 answers

2
Nick Campion On BEST ANSWER

It depends if Millennial Media is being a good citizen or not. If they are using the cache dir, you can use Context.getCacheDir to get the cache dir. I think you can then either iterate over the files it contains using a java recursive file delete call or delete the folder and remake it.

There is probably not a way to prevent Millennial Media from storing the cache in some other location without violating the AdWhirl terms of service.