Code example for NotificationManager

Methods: cancel

0
            return; 
        } 
 
        // Fall back on the old API. Note to cancel BEFORE changing the 
        // foreground state, since we could be killed at that point. 
        mNM.cancel(mNotificationId);
        mSetForegroundArgs[0] = Boolean.FALSE;
        invokeMethod(mSetForeground, mSetForegroundArgs);
    } 
 
    public void init() { 
        mNM = (NotificationManager) mService.getSystemService(Service.NOTIFICATION_SERVICE);
        try { 
            mStartForeground = mService.getClass().getMethod("startForeground",
                    mStartForegroundSignature);
            mStopForeground = mService.getClass().getMethod("stopForeground",
                    mStopForegroundSignature);
            return; 
        } catch (NoSuchMethodException e) {
            // Running on an older platform. 
            mStartForeground = mStopForeground = null;