1
0
mirror of https://github.com/PurpleI2P/i2pd-android.git synced 2025-02-03 02:14:24 +00:00

fix permissions API level

Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
R4SAS 2023-01-07 17:38:18 +03:00
parent 2e10678278
commit dd17608af9
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2

View File

@ -29,7 +29,7 @@ public class I2PDPermsAskerActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//if less than Android 6, no runtime perms req system present //if less than Android 6, no runtime perms req system present
if (android.os.Build.VERSION.SDK_INT < 23) { if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
startMainActivity(); startMainActivity();
return; return;
} }
@ -53,7 +53,7 @@ public class I2PDPermsAskerActivity extends Activity {
textview_retry.setVisibility(TextView.GONE); textview_retry.setVisibility(TextView.GONE);
button_request_write_ext_storage_perms.setVisibility(Button.GONE); button_request_write_ext_storage_perms.setVisibility(Button.GONE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if(!Environment.isExternalStorageManager()) { if(!Environment.isExternalStorageManager()) {
showExplanation(); showExplanation();
} else { } else {
@ -163,7 +163,7 @@ public class I2PDPermsAskerActivity extends Activity {
// Check which request we're responding to and make sure the request was successful // Check which request we're responding to and make sure the request was successful
if (requestCode == SHOW_EXPLANATION_REQUEST && resultCode == RESULT_OK) { if (requestCode == SHOW_EXPLANATION_REQUEST && resultCode == RESULT_OK) {
// Request the permission // Request the permission
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Intent intentManageAccess = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + BuildConfig.APPLICATION_ID)); Intent intentManageAccess = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + BuildConfig.APPLICATION_ID));
startActivityForResult(intentManageAccess, APP_STORAGE_ACCESS_REQUEST_CODE); startActivityForResult(intentManageAccess, APP_STORAGE_ACCESS_REQUEST_CODE);
} else { } else {