NativeStorage

Improve this doc

$ ionic plugin add cordova-plugin-nativestorage

Repo: https://github.com/TheCocoaProject/cordova-plugin-nativestorage

Native storage of variables in Android and iOS

Usage

import { NativeStorage } from 'ionic-native';

NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
  .then(
    () => console.log('Stored item!'),
    error => console.error('Error storing item', error)
  );

NativeStorage.getItem('myitem')
  .then(
    data => console.log(data),
    error => console.error(error)
  );

Static Members

setItem(reference, value)

Stores a value

Param Type Details
reference string
value

Returns: Promise<any>

getItem(reference)

Gets a stored item

Param Type Details
reference string

Returns: Promise<any>

remove(reference)

Removes a single stored item

Param Type Details
reference string

Returns: Promise<any>

clear()

Removes all stored values.

Returns: Promise<any>

API

Native

General