How to remove data from native storage in ionic 4

i'm actually trying to remove a precise data in my native storage and i try to use splice but i'm not sure that its working like this , do you have an idea ?

this.nativeStorage.getItem('AccepterPart').then(res => {
              for (let i of (JSON.parse(res))) {
                if (i['HISTO_N'] == this.currentNumInter) {
                  i['HISTO_Objet2'] = '106';
                  this.tabEffectuer.push(i);
                }
                var p = JSON.parse(res);
                var ind = p.findIndex(i => i['HISTO_N'] === this.currentNumInter);
                var inde = p.filter(i => i.HISTO_N !== this.currentNumInter);
                p.splice(inde);
                this.nativeStorage.setItem('AccepterPart', JSON.stringify(p));
              }
              this.nativeStorage.setItem('EffectuerPart', JSON.stringify(this.tabEffectuer));
            });  

To clear storage completely , use

this.nativeStorage.clear();

To remove a field, use

 this.nativeStorage.remove('AccepterPart');

How to remove data from native storage in ionic 4, How to remove data from native storage in ionic 4 � launch the app, trigger whatever causes the modification code under test to fire � terminate the� Ionic is the app platform for web developers. Build amazing mobile, web, and desktop apps all with one shared code base and open web standards <!--t.4.5.4.0-->ionicframework.com

but in the array 'AccepterPart' i want to remove the var p , i can't indicate the data i want to delete from AccepterPart ?

Native Storage, Native storage of variables in Android and iOS ionic cordova plugin add cordova-plugin-nativestorage npm install @ionic-native/native-storage npm install� In this post, we learned how to implement ionic SQLite-storage and ionic native-storage, we got to know the difference and the use of these two in ionic 4 application. I hope this post made your confusions clear that what is ionic-storage and why to use, as same for the native-storage.

Sorry for the response time but a took note about what you said but i used something new but i don't know what it doesn't work. I tried to use findIndex to know the position of my value in the key 'AccepterPart' and the splice to remove this value from my key but i don't know why it doesn't work ,Do you have an idea ?

this.nativeStorage.getItem('AccepterPart').then(res => {
              for (let i of (JSON.parse(res))) {
                if (i['HISTO_N'] == this.currentNumInter) {
                  i['HISTO_Objet2'] = '106';
                  this.tabEffectuer.push(i);
                }
                var p = JSON.parse(res);
                var ind = p.findIndex(i => i.HISTO_N == this.currentNumInter);
                var inde = p.filter(i => i.HISTO_N != this.currentNumInter);
                p.splice(ind);
                this.nativeStorage.setItem('AccepterPart', JSON.stringify(p));
              }

Ionic 4 - Save and Retrieve Data Locally on Device, For storing and retreiving data locally in an Ionic 4 App. the pitfalls of things like local storage and IndexedDB, such as the OS deciding to clear out such data� i saw anything that’s the problem , i want when i click on a button too delete a precise data in the native storage from ionic 4 but at least it’s no working , the data i want to delete is already here. I try to use nativeStorage.remove but its the same result

Ionic 5 Native Storage Tutorial, Today we will learn how to store data using Ionic 5 NativeStorage, We will learn how to In SQLite in Ionic 4 is used for native apps that work on mobile devices. To remove value from storage use the following method. this. Implementing Storage in Ionic App. Ionic offers two ways to store data in the storage. Storage in Ionic Cordova SQLite. Cordova’s sqlite storage plugin is used to save the data in key/value pairs & JSON format, we use Ionic’s storage module with Cordova’s cordova-sqlite-storage plugin. In SQLite in Ionic 4 is used for native apps that

Ionic4 Native Storage, It shows how to store data locally inside app , retrieve and delete with native storage plugin.Duration: 6:46 Posted: Aug 4, 2019 Ionic is the app platform for web developers. Build amazing mobile, web, and desktop apps all with one shared code base and open web standards

Ionic 5|4 Storage Tutorial in Ionic using Native Storage Plugin , Now to install Cordova and Ionic Native plugin for Storage run nativeStorage. remove('freakyItem2') .then( data => console.log(data), error� When running in a native app context, Storage will prioritize using SQLite, as it's one of the most stable and widely used file-based databases, and avoids some of the pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such data in low disk-space situations.

Comments
  • Note, I Suggest to use Localstorage instead of Ionic Native storage. Since Localstorage is more faster than Ionic Nativestorage.