示例#1
0
  @Override
  protected void initView() {

    helper = new PermissionHelper(this);
    helper.setOnApplyPermissionListener(
        new PermissionHelper.OnApplyPermissionListener() {
          @Override
          public void onAfterApplyAllPermission() {
            runApp();
          }
        });

    if (Build.VERSION.SDK_INT < 23) { // 23以后的权限需要申请
      runApp();
    } else {
      if (helper.isAllRequestedPermissionGranted()) { // 已经全部授权
        runApp();
      } else {
        helper.applyPermissions();
      }
    }
  }
示例#2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   helper.onActivityResult(requestCode, resultCode, data);
 }
示例#3
0
 @Override
 public void onRequestPermissionsResult(
     int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
   super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   helper.onRequestPermissionsResult(requestCode, permissions, grantResults);
 }