use of permissions.dispatcher.OnNeverAskAgain in project file.io-app by rumaan.
the class MainActivity method showAppDetailsSettings.
/* Opens App info screen in settings */
@OnNeverAskAgain({ Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE })
void showAppDetailsSettings() {
Toast.makeText(this, getString(R.string.app_wont_work), Toast.LENGTH_LONG).show();
try {
Intent intent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
intent = new Intent(Intent.ACTION_APPLICATION_PREFERENCES);
intent.setData(Uri.parse("package:" + getPackageName()));
startActivity(intent);
} else {
intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package: " + getPackageName()));
startActivity(intent);
}
} catch (ActivityNotFoundException e) {
Intent intent = new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
startActivity(intent);
e.printStackTrace();
}
}
use of permissions.dispatcher.OnNeverAskAgain in project ETSMobile-Android2 by ApplETS.
the class MoodleCourseDetailsFragment method showPermissionsSnackbar.
/**
* Shows a snackbar in case he/she needs to allow the app to write to external storage
* in order to download a file coming from Moodle.
*/
@OnPermissionDenied(Manifest.permission.WRITE_EXTERNAL_STORAGE)
@OnNeverAskAgain(Manifest.permission.WRITE_EXTERNAL_STORAGE)
void showPermissionsSnackbar() {
Snackbar snackbar = Snackbar.make(getView(), R.string.moodle_allow_storage_permissions, Snackbar.LENGTH_SHORT).setAction(R.string.action_settings, (listener) -> Utility.goToAppSettings(listener.getContext())).setActionTextColor(ContextCompat.getColor(getActivity(), R.color.ets_red));
snackbar.show();
}
Aggregations