Skip to content

Commit

Permalink
Merge pull request #103 from wytlytningNZ/feature/dynamic-shared-pref…
Browse files Browse the repository at this point in the history
…erences

Allow the shared preferences name to be defined in cordova's config.xml file
  • Loading branch information
GillesC authored Dec 18, 2017
2 parents 11cbc5a + d0839f4 commit 3ac059f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/android/NativeStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

public class NativeStorage extends CordovaPlugin {
public static final String TAG = "Native Storage";
public static final String PREFS_NAME = "NativeStorage";
private SharedPreferences sharedPref;
private SharedPreferences.Editor editor;

Expand All @@ -36,6 +35,7 @@ public NativeStorage() {
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
Log.v(TAG, "Init NativeStorage");
String PREFS_NAME = preferences.getString("NativeStorageSharedPreferencesName", "NativeStorage");
sharedPref = cordova.getActivity().getSharedPreferences(PREFS_NAME, Activity.MODE_PRIVATE);
editor = sharedPref.edit();
}
Expand Down

0 comments on commit 3ac059f

Please sign in to comment.