List of usage examples for android.content Context checkCallingOrSelfPermission
@CheckResult(suggest = "#enforceCallingOrSelfPermission(String,String)") @PackageManager.PermissionResult public abstract int checkCallingOrSelfPermission(@NonNull String permission);
From source file:Main.java
private static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE"); return perm == 0; }
From source file:Main.java
public static final boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE"); return perm == PackageManager.PERMISSION_GRANTED; }
From source file:Main.java
public static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE"); return perm == PackageManager.PERMISSION_GRANTED; }
From source file:Main.java
protected static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission(EXTERNAL_STORAGE_PERMISSION); return perm == PackageManager.PERMISSION_GRANTED; }
From source file:Main.java
public static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission(EXTERNAL_STORAGE_PERMISSION); return perm == PackageManager.PERMISSION_GRANTED; }
From source file:Main.java
private static boolean hasVibrationPermission(Context context) { int result = context.checkCallingOrSelfPermission(permission.VIBRATE); return (result == PackageManager.PERMISSION_GRANTED); }
From source file:Main.java
public static boolean checkPermissionGranted(String p, Context c) { return c.checkCallingOrSelfPermission(p) == PackageManager.PERMISSION_GRANTED; }
From source file:Main.java
@SuppressWarnings("unused") private static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission(EXTERNAL_STORAGE_PERMISSION); return perm == PackageManager.PERMISSION_GRANTED; }
From source file:Main.java
public static int isSystemApp(Context context) { int pe = context.checkCallingOrSelfPermission(android.Manifest.permission.INSTALL_PACKAGES); if (pe == PackageManager.PERMISSION_GRANTED) return 0; return 1;/* w w w.j a v a 2 s.c om*/ }
From source file:Main.java
public static boolean hasPermission(Context context, String name) { int res = context.checkCallingOrSelfPermission(name); return (res == PackageManager.PERMISSION_GRANTED); }