Dan Cehan
Dan Cehan

Reputation: 41

How to remove User data from my app through Ionic?

I have an Ionic 4 App that use IonicStorage with IndexDb . The user will take some photos that will be saved in the storage. After the process is done, if the user will take a look into app settings will see something like this:

enter image description here

Problem: When the user will attempt to perform another login the user data must be erased, cleared. I tried to delete the data by calling the clear method from the storage.

/**
     * Clear the entire key value store. WARNING: HOT!
     * @returns {Promise} Returns a promise that resolves when the store is cleared
     */
    public ClearStorage(): Promise<any> {
        return this.ionicStorage.clear();
    }

Also I added these flags in the config.xml ...but without success. I can't erase it

...
 <application android:allowBackup="false" />
 <application android:fullBackupContent="false" />
...

Can you suggest me something. Ty

Upvotes: 0

Views: 615

Answers (3)

Dan Cehan
Dan Cehan

Reputation: 41

I understand whats happens with the storage and with the user's data. The problem is not the clear function, it's working perfectly fine. The problem is that the methods from the storage object are logged into a specific file. Basically when I save a base-64 photo into a storage object it automatically add a new entry to the log file (eg: One base64 string image has around 500kb so the log file size will increase with 500kb).

enter image description here

The file is also private. The problem that also remains, so how can I delete the log file from Ionic?

Upvotes: 1

Dan Cehan
Dan Cehan

Reputation: 41

Yes, this is working just on the app storage (saw it through chrome inspector). The user data are not cleared.

Upvotes: 0

haron68
haron68

Reputation: 791

Try this.ionicStorage.remove('yourStorageKey') for each of your storage keys to remove all data in IndexedDB or sqlLite.

Upvotes: 0

Related Questions