Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the Clear Data button in Application info of Manage application

Tags:

android

sqlite

I am working on android 2.2, In a Application tab of android manifest provide the option of "Allow clear data" to set true or false. But after setting it to False, my application can't disable the button of Clear data in application info of Manage application. I am facing this problem when application contains database in Data/Data/packge-name/databases/.

I have to protect my application database from user.

like image 308
Neo Avatar asked Jun 30 '11 07:06

Neo


People also ask

How do I turn off clear data on Android?

In this scenario Android OS will show a Manage Space button in place of clear data. Upon clicking it will open ManageSpaceActivity. If you do this. It will disable the Clear data button.

What happens if you click clear data on an app?

So, when you clear App Data, it not only clears the Cache but also resets the application, meaning you'll have more space in storage. But you will have to sign in again on Netflix.

What is clear data in app Manager?

Clearing data essentially reset an app to its default state: it makes your app act like when you first downloaded and installed it. For example, say you make changes to the settings of your favorite fitness app.


1 Answers

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

As far as I have been able to tell, this works 100% of the time.

like image 163
Reed Avatar answered Sep 18 '22 11:09

Reed