Hey there,
I recently attempted to implement code from the Native Storage plugin documentation found at this link: Native Storage
import { NativeStorage } from '@ionic-native/native-storage';
constructor(private nativeStorage: NativeStorage) { }
...
this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
.then(
() => console.log('Item stored!'),
error => console.error('Error storing item', error)
);
this.nativeStorage.getItem('myitem')
.then(
data => console.log(data),
error => console.error(error)
);
Upon launching my android simulator device, the console outputs the following:
[00:02:01] console.log: Item stored!
[00:02:01] console.log: [object Object]
https://i.sstatic.net/qYTKh.png
I am currently seeking a solution to retrieve the stored information. My goal is to leverage data stored in the native storage for conditional logic on another page, but I am facing challenges with retrieval. For instance, I intend to execute a function if the value of "Vibrator" stored in native storage is true. Can anyone provide guidance on how to achieve this?
Appreciate your support!