where preferencesJSON describes the settings to be shown.
The values can be accessed and modified programmatically by calling
Replace www\index.html with the contents of index.html.
Note (Android specific), save the file validation.html to www\validation.html. If the setting webapppath in the preferencesJSON is incorrect, the validation function will not work.
On Android, optionally choose a different theme for the settings dialog by modifying AndroidManifest.xml and changing minSdkVersion to 11 and the theme for PrefsActivity from Theme.Black.NoTitleBar to Theme.Holo.Light. See also Android Themes.
Prepare, build and deploy the app with the following commands.
cordova run android
cordova run ios
Note, in addition to the four types which are edittext, switch, checkbox and list there is also a button type that when pressed simply triggers the validation function on Android.
On Android, if an alert() call is made following the call to sap.AppPreferences.showPreferencesScreen or in the successcallback method, the validation function will not be called in versions of Android less than 4.4. A workaround for this is to add the plugin org.apache.cordova.dialogs and then to use navigator.notification.alert() instead of alert().
This plugin is mainly used with the SAP Fiori Client and has some bugs/limitations. The following are some of the issues seen while working with the above sample. BCP 1482004286. On iOS, each setting must have a category. BCP 1482005324. Missing support for switch and checkbox on iOS. BCP 1482005323. Readonly attribute does not appear to work with a list type on Android or iOS. BCP 1482005322. Defaultvalue attribute does not work for edittext types on iOS.