check App Permission - Android App

Android examples for App:App Information

Description

check App Permission

Demo Code


//package com.java2s;

import android.content.Context;

import android.content.pm.PackageManager;

public class Main {

    public static final boolean checkPermission(Context context,
            String premission) {//from  ww w .ja  v  a  2s . c o m
        PackageManager localPackageManager = context.getPackageManager();
        if (localPackageManager.checkPermission(premission,
                context.getPackageName()) != android.content.pm.PackageManager.PERMISSION_GRANTED) {
            return false;
        }
        return true;
    }
}

Related Tutorials