Code example for Context

Methods: getSystemServicesendBroadcast, removeStickyBroadcast

0
     * Cancels low storage notification and sends OK intent. 
     */ 
    private final void cancelNotification() { 
        if(localLOGV) Log.i(TAG, "Canceling low memory notification");
        NotificationManager mNotificationMgr =
                (NotificationManager)mContext.getSystemService(
                        Context.NOTIFICATION_SERVICE);
        //cancel notification since memory has been freed 
        mNotificationMgr.cancel(LOW_MEMORY_NOTIFICATION_ID);
 
        mContext.removeStickyBroadcast(mStorageLowIntent);
        mContext.sendBroadcast(mStorageOkIntent);
    } 
     
    public void updateMemory() { 
        int callingUid = getCallingUid();
        if(callingUid != Process.SYSTEM_UID) {
            return; 
        } 
        // force an early check 
        postCheckMemoryMsg(true, 0);