App Preferences

Improve this doc

This plugin allows you to read and write app preferences

Repo: https://github.com/apla/me.apla.cordova.app-preferences

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-app-preferences
    $ npm install --save @ionic-native/app-preferences
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { AppPreferences } from '@ionic-native/app-preferences';

constructor(private appPreferences: AppPreferences) { }

...

this.appPreferences.fetch('key').then((res) => { console.log(res); });

Instance Members

fetch(dict, key)

Get a preference value

Param Type Details
dict string

Dictionary for key (OPTIONAL)

key string

Key

Returns: Promise<any> Returns a promise

store(dict, key, value)

Set a preference value

Param Type Details
dict string

Dictionary for key (OPTIONAL)

key string

Key

value any

Value

Returns: Promise<any> Returns a promise

remove(dict, key)

Remove value from preferences

Param Type Details
dict string

Dictionary for key (OPTIONAL)

key string

Key

Returns: Promise<any> Returns a promise

clearAll()

Clear preferences

Returns: Promise<any> Returns a promise

show()

Show native preferences interface

Returns: Promise<any> Returns a promise

watch(subscribe)

Show native preferences interface

Param Type Details
subscribe boolean

true value to subscribe, false - unsubscribe

Returns: Observable<any> Returns an observable

suite(suiteName)

Platforms:Android 

Return named configuration context In iOS you’ll get a suite configuration, on Android — named file Supports: Android, iOS

Param Type Details
suiteName string

suite name

Returns: Object Custom object, bound to that suite

iosSuite()

Platforms:iOS 

cloudSync()

Platforms:iOS Windows Windows Phone 8 

Return cloud synchronized configuration context Currently supports Windows and iOS/macOS

Returns: Object Custom object, bound to that suite

defaults()

Platforms:iOS Windows Windows Phone 8 

Return default configuration context Currently supports Windows and iOS/macOS

Returns: Object Custom Object, bound to that suite

API

Native

General