mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 18:15:49 +01:00
Permissions must be persistet to be reused after boot
This commit is contained in:
parent
65c83c404c
commit
559cd557c2
@ -293,6 +293,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
|||||||
Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||||
i.setType("application/x-sqlite3");
|
i.setType("application/x-sqlite3");
|
||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
i.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
String title = getApplicationContext().getString(R.string.choose_auto_export_location);
|
String title = getApplicationContext().getString(R.string.choose_auto_export_location);
|
||||||
startActivityForResult(Intent.createChooser(i, title), FILE_REQUEST_CODE);
|
startActivityForResult(Intent.createChooser(i, title), FILE_REQUEST_CODE);
|
||||||
return true;
|
return true;
|
||||||
@ -355,9 +356,10 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
if (requestCode == FILE_REQUEST_CODE && data != null) {
|
if (requestCode == FILE_REQUEST_CODE && intent != null) {
|
||||||
Uri uri = data.getData();
|
Uri uri = intent.getData();
|
||||||
|
getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
PreferenceManager
|
PreferenceManager
|
||||||
.getDefaultSharedPreferences(this)
|
.getDefaultSharedPreferences(this)
|
||||||
.edit()
|
.edit()
|
||||||
|
Loading…
Reference in New Issue
Block a user