Sasank Sunkavalli Sasank Sunkavalli - 2 months ago 12
Android Question

How to Clear the localStorage of a Cordova app for Android Platform

Im using localStorage(Key-value pairs) for saving the data in my Cordova app. Is there any way to clear the app's localStorage programmatically. One way is to clear the App's Data in Application Manager Settings, But i want to Clear the localStorage programmatically. Instead of using the Clear Data , I'm using ManageSpaceActivity(http://developer.android.com/guide/topics/manifest/application-element.html) in my application . Once the Manage Space button is clicked , I have to clear the localstorage. The problem is I don't have WebView instance in ManageSpaceActivity

Answer

For this, first you have to find which platform you are..for this read more for this plugin

By this command you will get to know which device you are using

var string = device.platform;

When you will get on which platform you are, you can start working towards.

To clear localStorage of Android platform, use this

localStorage.clear();

For more detail about this, read here

Comments