Code example for Context

Methods: checkCallingOrSelfPermission

0
        finalize_native(mNativePointer);
        super.finalize(); 
    } 
 
    public void vibrate(long milliseconds) {
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.VIBRATE)
                != PackageManager.PERMISSION_GRANTED) {
            throw new SecurityException("Requires VIBRATE permission");
        } 
        doCancelVibrate(); 
        vibratorOn(milliseconds);
    } 
 
    private boolean isAll0(long[] pattern) {
        int N = pattern.length;
        for (int i = 0; i < N; i++) {
            if (pattern[i] != 0) {
                return false; 
            } 
        } 
        return true;