Code example for PackageManager

Methods: checkPermission

0
	} 
	// @formatter:on 
 
	public static boolean hasInternet(Context context, String packageName) {
		PackageManager pm = context.getPackageManager();
		return (pm.checkPermission("android.permission.INTERNET", packageName) == PackageManager.PERMISSION_GRANTED);
	} 
 
	public static boolean hasPermission(Context context, String packageName, String restrictionName) {
		return hasPermission(context, packageName, getPermissions(restrictionName));
	} 
 
	public static boolean hasPermission(Context context, String packageName, MethodDescription md) {
		List<String> listPermission = (md.getPermissions() == null ? null : Arrays.asList(md.getPermissions()));
		return hasPermission(context, packageName, listPermission);
	} 
 
	@SuppressLint("DefaultLocale") 
	private static boolean hasPermission(Context context, String packageName, List<String> listPermission) {
		try { 
			if (listPermission == null || listPermission.size() == 0 || listPermission.contains(""))