Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="applicationPreferences">
<param name="android-package" value="com.appgiraffe.plugins.applicationPreferences"/>
<!-- android-package value should contain fully qualified class name -->
<param name="android-package" value="com.appgiraffe.plugins.applicationPreferences.applicationPreferences"/>
</feature>
</config-file>
<source-file src="src/android/applicationPreferences.java" target-dir="src/com/appgiraffe/plugins/applicationPreferences" />
Expand Down
7 changes: 5 additions & 2 deletions src/android/applicationPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public boolean execute(String action, JSONArray args,
} else if (action.equals("set")) {
String key = args.getString(0);
String value = args.getString(1);
if (sharedPrefs.contains(key)) {
//we should avoid this condition because it doesnt allow adding new <key,value>
//if (sharedPrefs.contains(key)) {
Editor editor = sharedPrefs.edit();
if ("true".equals(value.toLowerCase()) || "false".equals(value.toLowerCase())) {
editor.putBoolean(key, Boolean.parseBoolean(value));
Expand All @@ -54,10 +55,12 @@ public boolean execute(String action, JSONArray args,
editor.commit();
callbackContext.success();
return true;
} else {
/*
} else {
callbackContext.error("No such property called " + key);
return false;
}
*/
} else if (action.equals("load")) {
JSONObject obj = new JSONObject();
Map<String,?> prefs = sharedPrefs.getAll();
Expand Down