From abb316d364719656cef03c1488142537e2458c7f Mon Sep 17 00:00:00 2001 From: Andrea Bruschi Date: Wed, 20 May 2020 11:07:05 +0200 Subject: [PATCH] Update to run on API > 17 MODE_WORLD_READABLE (Constant value 0x00000001) was deprecated in API Level 17. Shared Preferences functionality crashes the app. Editing the value to MODE_PRIVATE (Constant value 0x00000000) fixes the issue. --- .../OMTG_Android/OMTG_DATAST_001_SharedPreferences.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android/MSTG-Android-Java-App/app/src/main/java/sg/vp/owasp_mobile/OMTG_Android/OMTG_DATAST_001_SharedPreferences.java b/Android/MSTG-Android-Java-App/app/src/main/java/sg/vp/owasp_mobile/OMTG_Android/OMTG_DATAST_001_SharedPreferences.java index cb3f14d..7103279 100644 --- a/Android/MSTG-Android-Java-App/app/src/main/java/sg/vp/owasp_mobile/OMTG_Android/OMTG_DATAST_001_SharedPreferences.java +++ b/Android/MSTG-Android-Java-App/app/src/main/java/sg/vp/owasp_mobile/OMTG_Android/OMTG_DATAST_001_SharedPreferences.java @@ -18,7 +18,7 @@ protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); - SharedPreferences sharedPref = getSharedPreferences("key", MODE_WORLD_READABLE); + SharedPreferences sharedPref = getSharedPreferences("key", MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString("username", "administrator"); editor.putString("password", "supersecret");