Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

fix Backup/Restore preferences on Android 11+ #167

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,11 @@ public boolean onPreferenceClick(Preference arg0) {
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
File des = new File(Environment.getExternalStorageDirectory() + "/Talon/backup.prefs");
String desPath = context.getExternalFilesDir(null).getAbsolutePath() + "/backup.prefs";
File des = new File(desPath);
IOUtils.saveSharedPreferencesToFile(des, context);

Toast.makeText(context, context.getResources().getString(R.string.backup_success) + ": /Talon/backup.prefs", Toast.LENGTH_LONG).show();
Toast.makeText(context, context.getResources().getString(R.string.backup_success) + ": " + desPath, Toast.LENGTH_LONG).show();
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
Expand All @@ -450,7 +451,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
@Override
public boolean onPreferenceClick(Preference arg0) {

File des = new File(Environment.getExternalStorageDirectory() + "/Talon/backup.prefs");
File des = new File(context.getExternalFilesDir(null).getAbsolutePath() + "/backup.prefs");

String authenticationToken1 = sharedPrefs.getString("authentication_token_1", "none");
String authenticationTokenSecret1 = sharedPrefs.getString("authentication_token_secret_1", "none");
Expand Down