Example usage for android.app Activity checkCallingOrSelfPermission

List of usage examples for android.app Activity checkCallingOrSelfPermission

Introduction

In this page you can find the example usage for android.app Activity checkCallingOrSelfPermission.

Prototype

@Override
    public int checkCallingOrSelfPermission(String permission) 

Source Link

Usage

From source file:com.gamethrive.TrackGooglePurchase.java

static boolean CanTrack(Activity activity) {
    if (iapEnabled == -99)
        iapEnabled = activity.checkCallingOrSelfPermission("com.android.vending.BILLING");
    try {/*  ww  w  .  j a  v  a2 s.  c  o m*/
        if (iapEnabled == PackageManager.PERMISSION_GRANTED)
            IInAppBillingServiceClass = Class.forName("com.android.vending.billing.IInAppBillingService");
    } catch (Throwable t) {
        iapEnabled = 0;
        return false;
    }

    return (iapEnabled == PackageManager.PERMISSION_GRANTED);
}