The same as {@link #checkReceiver(android.content.Context, String, android.content.Intent, String)}
with the {@code null} value for the {@code permission} parameter.
551971
public static void checkReceiver(@NonNull final Context context,
                                     @NonNull final String receiverName,
                                     @NonNull final Intent broadcastIntent) {
        checkReceiver(context, receiverName, broadcastIntent, null);
    }
861434
@RequiresPermission(allOf = {Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH})
	public final void stopScan(@NonNull final Context context,
							   @NonNull final PendingIntent callbackIntent) {
		//noinspection ConstantConditions
		if (callbackIntent == null) {
			throw new IllegalArgumentException("callbackIntent is null");
		}
		//noinspection ConstantConditions
		if (context == null) {
			throw new IllegalArgumentException("context is null");
		}
		stopScanInternal(context, callbackIntent);
	}
128474
protected boolean doesAppHasInternetPermission(Context context) {
        int result = context.checkCallingOrSelfPermission(Manifest.permission.INTERNET);
        boolean permissionGranted = (result == PackageManager.PERMISSION_GRANTED);

        if (!permissionGranted) {
            PrefHelper.Debug("Trouble executing your request. Please add 'android.permission.INTERNET' in your applications manifest file");
        }

        return result == PackageManager.PERMISSION_GRANTED;
    }
657849
private void getNetworkInfo() {
		// Create a listener to check for new network connections (e.g. switching from mobile to Wifi, or losing internet connection)
		NetworkConnectionListener listener = new NetworkConnectionListener() {

			@Override
			public void networkChanged(NetworkConnectionType newConnection) {
				Log.i("BMSCore", "New network connection: " + newConnection.toString());
			}
		};

		// Initilize the network monitor with the application context and network change listener
		this.networkMonitor = new NetworkMonitor(getApplicationContext(), listener);

		// Start listening for network changes
		networkMonitor.startMonitoringNetworkChanges();

		// See if the device currently has internet access, and see what type of connection it is using
		Log.i("BMSCore", "Is connected to the internet: " + networkMonitor.isInternetAccessAvailable());
		Log.i("BMSCore", "Connection type: " + networkMonitor.getCurrentConnectionType().toString());

		// Check that the user has given permissions to read the phone's state.
		// If permission is granted, get the type of mobile data network being used.
		int networkPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE);
		if (networkPermission == PackageManager.PERMISSION_GRANTED) {
			Log.i("BMSCore", "Mobile network type: " + networkMonitor.getMobileNetworkType());
		}
		else {
			Log.i("BMSCore", "Obtaining permission to read phone state");
			if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_PHONE_STATE)) {
				// Asynchronously explain to the user why you are attempting to request this permission.
				// Once this is done, try to request the permission again.
			}
			else {
				ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, MY_PERMISSIONS_READ_PHONE_STATE);
			}
		}
	}
875041
public static boolean hasPermission(Permission permission) {
        SecurityManager security = System.getSecurityManager();
        if (security != null) {
            try {
                security.checkPermission(permission);
            } catch (java.security.AccessControlException e) {
                return false;
            }
        }
        return true;
    }
1368780
static void requestPermission(Source source, String[] permissions) {
        Intent intent = new Intent(source.getContext(), BridgeActivity.class);
        intent.putExtra(KEY_TYPE, BridgeRequest.TYPE_PERMISSION);
        intent.putExtra(KEY_PERMISSIONS, permissions);
        source.startActivity(intent);
    }
376350
private static void checkPermission() {
        SecurityManager security = System.getSecurityManager();
        if (security != null)
            security.checkPermission(modifyThreadPermission);
    }
81530
public Object getCorrectedReceiver() {
        Object receiver = args[0];
        if (receiver==null) {
            if (LOG_ENABLED) LOG.info("receiver is null");
            receiver = NullObject.getNullObject();
        }
        return receiver;
    }
647174
@Override
    public boolean isReceiveAllowed()
    {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "isReceiveAllowed");

        boolean isReceiveAllowed = getTarget().isReceiveAllowed();

        if (tc.isEntryEnabled())
            SibTr.exit(tc, "isReceiveAllowed", new Boolean(isReceiveAllowed));

        return isReceiveAllowed;
    }
962619
private void requestCameraPermission() {
		int permissionCheck = ContextCompat.checkSelfPermission(this,
				Manifest.permission.CAMERA);

		if( permissionCheck != android.content.pm.PackageManager.PERMISSION_GRANTED) {
			ActivityCompat.requestPermissions(this,
					new String[]{Manifest.permission.CAMERA},
					0);
			// a dialog should open and this dialog will resume when a decision has been made
		}
	}
25117
protected String isConsentRequired(final Service service, final RegisteredService registeredService,
                                       final Authentication authentication,
                                       final RequestContext requestContext) {
        val required = this.consentEngine.isConsentRequiredFor(service, registeredService, authentication).isRequired();
        return required ? EVENT_ID_CONSENT_REQUIRED : null;
    }
521773
private int checkSelfPermission(Activity activity, String permission) {
    try {
      return androidPermissionService.checkSelfPermission(activity, permission);
    } catch (RuntimeException ignored) {
      return PackageManager.PERMISSION_DENIED;
    }
  }
260459
@Override public void onActivityForResult(int requestCode) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
                if (isSystemAlertGranted()) {
                    permissionCallback.onPermissionGranted(new String[]{Manifest.permission.SYSTEM_ALERT_WINDOW});
                } else {
                    permissionCallback.onPermissionDeclined(new String[]{Manifest.permission.SYSTEM_ALERT_WINDOW});
                }
            }
        } else {
            permissionCallback.onPermissionPreGranted(Manifest.permission.SYSTEM_ALERT_WINDOW);
        }
    }
760477
@RequiresPermission(Manifest.permission.BLUETOOTH)
	static void checkAdapterStateOn(@Nullable final BluetoothAdapter adapter) {
		if (adapter == null || adapter.getState() != BluetoothAdapter.STATE_ON) {
			throw new IllegalStateException("BT Adapter is not turned ON");
		}
	}
739286
public static void getPermission(@NonNull Activity context, @NonNull String[] permissions, @NonNull Response response) {
        if (Build.VERSION.SDK_INT < 23) {
            response.permissionGranted();
        } else {

            HashSet<String> permissionSet = new HashSet<>();

            for (String permission : permissions)
                if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
                    permissionSet.add(permission);
                }

            if (permissionSet.size() > 0) {
                int id = 42167;
                while (map.containsKey(id))
                    id = random.nextInt(Short.MAX_VALUE * 2);

                map.put(id, new ResponseWrapper(response, permissions));

                context.requestPermissions(permissionSet.toArray(new String[permissionSet.size()]), id);
            } else {
                response.permissionGranted();
            }
        }
    }
1101749
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
		if (requestCode == permissionRequestCode) {
			if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
				if (onRequestPermissionsResultListener != null) {
					onRequestPermissionsResultListener.onRequestPermissionsGranted();
				}
			} else {
				if (onRequestPermissionsResultListener != null) {
					onRequestPermissionsResultListener.onRequestPermissionsDenied();
				}

				if (previouslyShouldShowRequestPermissionRationale != null && !previouslyShouldShowRequestPermissionRationale && !permissionDelegate.shouldShowRequestPermissionRationale(permission)) {
					//Note: onRequestPermissionsResult(...) is called immediately before onResume() (like onActivityResult(...)),
					// if the dialog is show immediately in this case an exception occurs ("java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState").
					pendingAppInfoDialog = true;
				}
			}
		}
	}
928330
public static <T> T checkNotNull (T value, String param)
    {
        if (value == null) {
            throw new NullPointerException("Must supply non-null '" + param + "'.");
        }
        return value;
    }