Problems writing to a file in Android? This is from Holden
Hernandez Carmenate, a CS6326 student:
The app does not ask for permissions if the API is greater than 22 (our app was developed using Marshmallow API 23, an unfortunate coincidence.)
The error
was fixed in the device, going to:
Settings /
Application Manager / <our application name> / Permission
I fixed it
in code including the following two lines in onCreate:
if(ActivityCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED)
requestPermissions(new
String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
1);
|