Skip to content

Commit

Permalink
Fix write file permission check for sdk > 31
Browse files Browse the repository at this point in the history
It looks like we don't need to perform this check to write to the
downloads directory on new versions of android.

Fixes #37
  • Loading branch information
psanford committed Nov 22, 2023
1 parent e2253f0 commit 5123b8f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Handler;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -37,7 +38,7 @@ public void run() {
@Override public void onAttach(Context ctx) {
super.onAttach(ctx);
Log.d("wormhole", "WriteFilePerm: onAttach()");
if (ctx.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.R && ctx.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST);
} else {
permissionResult(true);
Expand Down

0 comments on commit 5123b8f

Please sign in to comment.