@nativescript-community/preferences
Common API to allow users to use native (familiar) app settings screens instead of having to craft custom UIs
npm i --save @nativescript-community/preferences
- Version: 1.3.2
- GitHub:
- NPM: https://www.npmjs.com/package/%40nativescript-community%2Fpreferences
- Downloads:
- Last Day: 7
- Last Week: 21
- Last Month: 116
@nativescript-community/preferences
This plugin allows native preference saving\loading on iOS and Android
iOS Prerequisites
- Create iOS Settings.bundle files in App_Resources/iOS See Demo or Apple Developer docs
Android Prerequisites
- In App_Resources/Android/xml create preferences.xml
- Android PreferenceScreen docs
Installation
Describe your plugin installation steps. Ideally it would be something like:
tns plugin add @nativescript-community/preferences
Usage
var prefs = new Preferences();
//Get existing value
prefs.getValue("name_preference");
//Set value
prefs.setValue("name_preference", "some new text");
API
Property | Default | Description |
---|---|---|
openSettings(): any; | Opens the native settings panes | |
getValue(key: string): any; | Gets the value for the preference | |
setValue(key: string, value: any): void; | Sets the passed value to the preference |
License
Apache License Version 2.0, January 2004