Created
August 9, 2020 17:39
-
-
Save ahmed-shehataa/fcd6345876e351fc2d6fecf976900a14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Grant run time permission | |
int permission = ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE); | |
if (permission == PackageManager.PERMISSION_GRANTED) { | |
} else { | |
Snackbar.make(getView(), "Please allow access to your storage", Snackbar.LENGTH_LONG) | |
.setAction("Allow", view -> ActivityCompat.requestPermissions(getActivity(), new String[]{ | |
Manifest.permission.WRITE_EXTERNAL_STORAGE | |
}, 0)).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment