cordova-plugin-shared-preferences

Cordova plugin for Android's Native key value storage system.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
cordova-plugin-shared-preferences
0.0.16 years ago6 years agoMinified + gzip package size for cordova-plugin-shared-preferences in KB

Readme

Cordova Plugin for Android SharedPreferences

Installation

cordova plugin add cordova-plugin-shared-preferences --save

Usage

document.addEventListener('deviceready', () => {
  const prefs = window.plugins.SharedPreferences
  prefs.getSharedPreferences('shared_preferences', 'MODE_PRIVATE', () => {
    prefs.putString('pref_key', 'some text')

    prefs.getString('pref_key', (value) => {
      alert(value)
    }, (error) => {
      // handle error
    })
  }, (error) => {
    // handle error
  })
}