Last active
January 15, 2017 06:47
-
-
Save ledzep9012/b8593647bd7ede9b3a60646a3cb82f17 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
public static void verifyStoragePermissions(Activity activity) { | |
// Check if we have write permission | |
int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE); | |
if (permission != PackageManager.PERMISSION_GRANTED) { | |
// We don't have permission so prompt the user | |
ActivityCompat.requestPermissions( | |
activity, | |
PERMISSIONS_STORAGE, | |
REQUEST_EXTERNAL_STORAGE | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment