Lê Khánh Vinh Lê Khánh Vinh - 4 months ago 30
Android Question

Android 6 permission Easy Permission library handle "Never check again"

Hi I'm Using Easy Permission library to handle android 6+ permission.

There is a method to call when "never ask again" is check


I dont know what parameter should we pass to the method

This is the method definition

public static boolean checkDeniedPermissionsNeverAskAgain(final Object object,
String rationale,
@StringRes int positiveButton,
@StringRes int negativeButton,
@Nullable DialogInterface.OnClickListener negativeButtonOnClickListener,
List<String> deniedPerms) {
boolean shouldShowRationale;
for (String perm : deniedPerms) {
shouldShowRationale = shouldShowRequestPermissionRationale(object, perm);
if (!shouldShowRationale) {
final Activity activity = getActivity(object);
if (null == activity) {
return true;

AlertDialog dialog = new AlertDialog.Builder(activity)
.setPositiveButton(positiveButton, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
startAppSettingsScreen(object, intent);
.setNegativeButton(negativeButton, negativeButtonOnClickListener)

return true;

return false;

But how to we pass the
. Any help is much appreciate. Thanks


It just wants a resource value from your strings.xml file. So just pass something like R.string.okay and R.string.cancel. If you don't have a strings.xml file setup (you probably should) but could also use system defaults and pass android.R.string.ok and android.R.string.cancel to that method. There are several built in system strings like that. Look here if you're curious.