1

Does we have any option/library in android app development to restrict our app's cache is being cleared?

We are facing a scenario based issue. Since, we are having offline app, which will be synced online whenever the user connected to network. In the meantime If the user runs some 'cleaning apps' erased all the offline data stored in our app.

Pl help me to proceed further this issue. We are holding both Hybrid android as well as Native android applications.

If the answer is NO, How to restructure/avoid using the cache storage of a HYBRID Applications?

rajmathan
  • 651
  • 6
  • 27

2 Answers2

1

My study on restricting Clear Cache of an android application using external library is not possible without changing file-storage path of our application from android temp(cache) folder to app asset(root) folder.

Default app cache storage path: internalStorage/Android/data/app_package_name/cache

This need to be changed from the mentioned cache storage path to app storage (ie, Keeping files in assets folder)

For CLEAR APP DATA option:

This can be done by adding android:manageSpaceActivity=".ActivityOfMyChoice" to the application tag of your Manifest like:

<application android:label="MyApp" android:icon="@drawable/icon" 
             android:manageSpaceActivity=".ActivityOfMyChoice">

Once it done the app shows "Manage Space" button instead of "Clear Data" in app storage option.

rajmathan
  • 651
  • 6
  • 27
0

Add android:manageSpaceActivity=".ActivityOfMyChoice"to the application tag of your Manifest like:

<application android:label="MyApp" android:icon="@drawable/icon" 
                 android:manageSpaceActivity=".ActivityOfMyChoice">

Then instead of "Clear Data", there is a button for "Manage Space" which launches ActivityOfMyChoice It's working for UC Browser and as well as dolphin browser.

Shobhit
  • 1,096
  • 11
  • 30
  • Am aware of this 'Clear Data' thing. Actually, I would like to know, Is there any fix available for 'Clear Cache' thing. If NO, Do we need to change the structure of app storage? Pl clarify – rajmathan Feb 20 '17 at 06:23