Back to project page growthpush-android.
The source code is released under:
Apache License
If you think the Android project growthpush-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.growthpush.utils; //www .ja v a 2s . co m import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; public class PermissionUtils { public static boolean permitted(Context context, String permission) { PackageInfo packageInfo = null; try { packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS); } catch (NameNotFoundException e) { return false; } String[] requestedPermissions = packageInfo.requestedPermissions; for (String requestedPermission : requestedPermissions) if (requestedPermission.equals(permission)) return true; return false; } }