Code example for Context

Methods: unregisterReceiver

0
 
    /** 
     * Stops the timer. No event can be scheduled after this method is called. 
     */ 
    public synchronized void stop() { 
        mContext.unregisterReceiver(this);
        if (mPendingIntent != null) {
            mAlarmManager.cancel(mPendingIntent);
            mPendingIntent = null;
        } 
        mEventQueue.clear();
        mEventQueue = null;
    } 
 
    private boolean stopped() { 
        if (mEventQueue == null) {
            Log.w(TAG, "Timer stopped");
            return true; 
        } else { 
            return false; 
        }