Skip to content

Commit

Permalink
Update to run on API > 17
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AndyCyberSec authored May 20, 2020
1 parent cf0b207 commit abb316d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit abb316d

Please sign in to comment.