I would like to save user preferences from a sketch working either on a PC or on an Android phone using the same code as the standard "Java way".
The ideal candidate for my purposes is the java.util.prefs.Preferences class. So, I wrote a small test script to see if it works in processing:
String prId = "counter";
Preferences prefs = Preferences.userNodeForPackage(this.getClass());
int counter = prefs.getInt(prId, 0);
println(counter);
prefs.putInt(prId, 1+counter);
This program displays an increasing number of times each time it is executed - on a PC. On Android, the default value (0) is always displayed. Are there any additional steps required to work on Android? Permissions for the request? Are there alternatives for storing name-value pairs on both platforms?
Designation: WRITE_EXTERNAL_STORAGE permission already enabled