-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Why don't You ask for permissions on main activity? If one goes to the settings would not be able to change the 'Wallpaper export location' since permissions are asked only when downloading a wallpaper. I think it would be easier and it would require only few lines of code
private final static int READ_EXTERNAL_STORAGE_PERMISSION_REQUEST=1;
and onCreate
if (Build.VERSION.SDK_INT >= 23 && PermissionChecker.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PermissionChecker.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, READ_EXTERNAL_STORAGE_PERMISSION_REQUEST);
}
You can also explain why you need permissions if You want
@Override
public void onRequestPermissionsResult (int requestCode, String[] permissions, int[] grantResults) {
if(requestCode==READ_EXTERNAL_STORAGE_PERMISSION_REQUEST && grantResults[0]!=PermissionChecker.PERMISSION_GRANTED) {
Utils.showMessageDialog();
}
}
showing a simple dialog using material dialogs library:)
public void showMessageDialog() {
new MaterialDialog.Builder(this)
.title(R.string.permissions_title)
.content(R.string.explain_why)
.positiveText(android.R.string.ok)
.negativeText(android.R.string.no)
.show();
}
just a hint :)
I don't have a working as, or I would have sent a pull request:)