private void startAppSettings() {
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    intent.setData(Uri.parse("package:" + getPackageName()));
    startActivity(intent);
  }
Show a dialog for user to explain about the permission.
xlog-sample/src/main/java/com/elvishew/xlogsample/MainActivity.java