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

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

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

Activity.checkCallingOrSelfPermission介绍

暂无

代码示例

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @param permission
 * @return
 * @see android.content.ContextWrapper#checkCallingOrSelfPermission(java.lang.String)
 */
public int checkCallingOrSelfPermission(String permission) {
  return mActivity.checkCallingOrSelfPermission(permission);
}

代码示例来源:origin: quaap/LaunchTime

private boolean isValidActivity(Intent intent) {
  List<ResolveInfo> list = activity.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
  if (list.size() > 0) {
    ActivityInfo ai = list.get(0).activityInfo;
    if (ai != null && (ai.permission==null || activity.checkCallingOrSelfPermission(ai.permission)==PackageManager.PERMISSION_GRANTED)) {
      int enabledflag = activity.getPackageManager().getComponentEnabledSetting(intent.getComponent());
      return ai.exported && (enabledflag == PackageManager.COMPONENT_ENABLED_STATE_ENABLED || enabledflag == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT && ai.enabled);
      //return ai.enabled && ai.exported;
    }
  }
  return false;
}

代码示例来源:origin: Mobisocial/EasyNFC

mActivity.checkCallingOrSelfPermission("android.permission.NFC")) {
mActivity.checkCallingOrSelfPermission("android.permission.BLUETOOTH")) {
mActivity.checkCallingOrSelfPermission("android.permission.INTERNET")) {

相关文章

Activity类方法