android.app.Activity.onRequestPermissionsResult()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中android.app.Activity.onRequestPermissionsResult()方法的一些代码示例,展示了Activity.onRequestPermissionsResult()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.onRequestPermissionsResult()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:onRequestPermissionsResult

Activity.onRequestPermissionsResult介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  mPermissionHelper.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

代码示例来源:origin: LawnchairLauncher/Lawnchair

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResult) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResult);
  onComplete(requestCode, permissions, grantResult);
}

代码示例来源:origin: crazycodeboy/TakePhoto

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  PermissionManager.TPermissionType type = PermissionManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
  PermissionManager.handlePermissionsResult(this, type, invokeParam, this);
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onRequestPermissionsResult(int requestCode,
                    String[] permissions,
                    int[] grantResults) {
 super.onRequestPermissionsResult(requestCode, permissions,
  grantResults);
 if (REQUEST_PERMS_FILE==requestCode) {
  if (canWriteFiles()) {
   for (Uri document : pendingFiles) {
    openEditor(document);
   }
   pendingFiles.clear();
  }
 }
}

代码示例来源:origin: pchab/AndroidRTC

@Override
  public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    permissionChecker.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
}

代码示例来源:origin: syncthing/syncthing-android

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                    @NonNull int[] grantResults) {
  switch (requestCode) {
    case REQUEST_COARSE_LOCATION:
      if (grantResults.length == 0 ||
          grantResults[0] != PackageManager.PERMISSION_GRANTED) {
        Log.i(TAG, "User denied ACCESS_COARSE_LOCATION permission.");
      } else {
        Toast.makeText(this, R.string.permission_granted, Toast.LENGTH_SHORT).show();
        Log.i(TAG, "User granted ACCESS_COARSE_LOCATION permission.");
      }
      break;
    case REQUEST_WRITE_STORAGE:
      if (grantResults.length == 0 ||
          grantResults[0] != PackageManager.PERMISSION_GRANTED) {
        Log.i(TAG, "User denied WRITE_EXTERNAL_STORAGE permission.");
      } else {
        Toast.makeText(this, R.string.permission_granted, Toast.LENGTH_SHORT).show();
        Log.i(TAG, "User granted WRITE_EXTERNAL_STORAGE permission.");
      }
      break;
    default:
      super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
}

代码示例来源:origin: ksvc/KSYMediaPlayer_Android

@Override
  public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
}

代码示例来源:origin: pwittchen/ReactiveBeacons

@Override public void onRequestPermissionsResult(int requestCode,
  @android.support.annotation.NonNull String[] permissions,
  @android.support.annotation.NonNull int[] grantResults) {
 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
 final boolean isCoarseLocation = requestCode == PERMISSIONS_REQUEST_CODE_ACCESS_COARSE_LOCATION;
 final boolean permissionGranted = grantResults[0] == PERMISSION_GRANTED;
 if (isCoarseLocation && permissionGranted && subscription == null) {
  startSubscription();
 }
}

代码示例来源:origin: yuan-gao/zhihuDaily-Weex

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
 if (mInstance != null) {
  mInstance.onRequestPermissionsResult(requestCode, permissions, grantResults);
 }
 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

代码示例来源:origin: kaknazaveshtakipishi/PermissionEverywhere

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  onComplete(requestCode, permissions, grantResults);
}

代码示例来源:origin: minggo620/AndroidAutoClick

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  mPermissionHelper.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

代码示例来源:origin: netmackan/ATimeTracker

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  switch (requestCode) {
    case MY_PERMISSIONS_REQUEST_EXPORT:
      if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
        requestExport();
      }
      break;
  }
}

代码示例来源:origin: pinetum/AirUnlock-for-Android

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  switch (requestCode) {
    case CAMERA_PERRMISSION_REQUEST:
      if (! (grantResults.length > 0
          && grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
        finish();
      }
      break;
  }
}

代码示例来源:origin: Demidong/ClockView

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}

代码示例来源:origin: upyun/android-push-sdk

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions,
                    int[] grantResults) {
  if (grantResults.length != 1 || grantResults[0] == PackageManager.PERMISSION_GRANTED) {
    pushVideo();
  } else {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
}

代码示例来源:origin: trello/navi

@Override @CallSuper public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
   @NonNull int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  base.onRequestPermissionsResult(requestCode, permissions, grantResults);
 }
}

代码示例来源:origin: campusappcn/Pan

@CallSuper
  @Override
  public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    Pan.call(this, OnRequestPermissionsResult.class, requestCode, permissions, grantResults);
  }
}

代码示例来源:origin: Euzee/permissionUtil

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                    @NonNull int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  handleGrantResult(checkGrantResults(grantResults));
}

代码示例来源:origin: PeterCxy/Shelter

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
  if (requestCode == REQUEST_PERMISSION_EXTERNAL_STORAGE) {
    if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
      doStartFileShuttle();
    } else {
      finish();
    }
  } else {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
}

代码示例来源:origin: microg/android_external_UnifiedNlpApi

@Override
  public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    boolean ok = true;
    for (int result : grantResults) {
      if (result != PackageManager.PERMISSION_GRANTED) ok = false;
    }
    setResult(ok ? RESULT_OK : RESULT_CANCELED);
    finish();
  }
}

相关文章

Activity类方法