@Override
              public void onClick(DialogInterface dialog, int which) {
                if (gotoSettings) {
                  startAppSettings();
                } else {
                  requestPermission();
                }
              }
Show a dialog for user to explain about the permission.
xlog-sample/src/main/java/com/elvishew/xlogsample/MainActivity.java