Android
Describes use of application preferences on Android.
On Android, you show the settings screen by calling:
sap.AppPreferences.showPreferencesScreen(successCallback, errorCallback);
On Android, you specify the settings by calling:
sap.AppPreferences.configurePreferencesScreen(preferencesJSON, successCallback, errorCallback);
where preferencesJSON describes the settings to be shown. The following is an excerpt of preferencesJSON, where Category 1 represents one group of settings.
{ "webapppath" : "file:///android_asset/www/validation.html", "validationfunction" : "validationFunction", "preferences" : [ { "Category 1" : [ { "key" : "fioriURL", "type" : "edittext", "title" : "Fiori URL", "summary" : "", //Summary does not apply to edittext type "defaultvalue" : "http://www.sap.com" }, { "key" : "option_1_2", "type" : "switch", "title" : "Option 2", "summary" : "This value can be used to ...", "defaultvalue" : "true" }, { "key" : "option_1_3", "type" : "checkbox", "title" : "Option 3", "summary" : "This value can be used to ...", "defaultvalue" : "true" }, { "key" : "option_1_4", "type" : "list", "title" : "Option 4", "summary" : "", //Summary does not apply to list type "defaultvalue" : "3", "listentries" : [ "one", "two", "three" ], "listvalues" : [ "1", "2", "3" ] } ] } }
On Android, if an alert() call is made following the call to sap.AppPreferences.showPreferencesScreen, the validation function is not called in versions of Android less than 4.4. A workaround for this issue is to add the plugin org.apache.cordova.dialogs and then to use navigator.notification.alert() instead of alert().