What is a ManageSpaceActivity on Android?
Posted on October 16, 2018 • 1 minutes • 184 words
Table of contents
A few days ago i had problems with an app and wanted to clear the app data. Usually you can do that under “Settings> Apps>”Name of the app” > STORAGE> CLEAR DATA” I don’t really remember why, but i clicked on the Google app and i discovered that it doesn’t have “Clear Data” but “Manage Space“. When you click on it, it will open an activity from the Google App where you can choose which data you want to delete. So i got curious how this works.
How to implement this?
All you need to do is to add android:manageSpaceActivity to the inside your Manifest.xml and the name of the activity that should be used.
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.jensklingenberg.jkmanagespaceactivity"> <application ... android:manageSpaceActivity=".ManageActivity" ... </application> </manifest>
Now the settings app will display the Manage Space Button for your app and open the linked activity, where you can provide your users specific options to delete the data of your app.
You can find the example app at https://github.com/Foso/JKManageSpaceActivity