code: private void showPermissionRequestDialog(final boolean gotoSettings) {
      new AlertDialog.Builder(this)
          .setTitle(R.string.permission_request)
          .setMessage(R.string.permission_explanation)
          .setNegativeButton(android.R.string.cancel, null)
          .setPositiveButton(gotoSettings ? R.string.go_to_settings : R.string.allow,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  if (gotoSettings) {
                    startAppSettings();
                  } else {
                    requestPermission();
                  }
                }
              })
          .show();
    }
docs: Show a dialog for user to explain about the permission.