Wednesday, May 8, 2013

[android-developers] Using App Cache - Without Trying to

A user recently told me that my app worked better after he cleared the App Cache. 

By better, I mean that it might not freeze up requiring a battery pull after a few seconds of scrolling the screen.

This is my nemesis, the Droid Razr Maxx HD, so I am following all leads, even if not credible.

I checked the code. I am not using the App Cache, at least on purpose. Nonetheless, I see 6 MB used on some devices.

So, while I am not doing this directly, I'm sure it might be happening inside jar files or by the system. Can anyone give me some insight?

I've checked the documentation, as below. It says I should be a good citizen by deleting things in the cache if they go over, say, 1 MB. Not sure how I could do this if I am not aware of what is being put into there.

 http://developer.android.com/guide/topics/data/data-storage.html

Saving cache files

If you'd like to cache some data, rather than store it persistently, you should use getCacheDir() to open a Filethat represents the internal directory where your application should save temporary cache files.

When the device is low on internal storage space, Android may delete these cache files to recover space. However, you should not rely on the system to clean up these files for you. You should always maintain the cache files yourself and stay within a reasonable limit of space consumed, such as 1MB. When the user uninstalls your application, these files are removed.



Nathan

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment