Code example for AlarmManager

Methods: cancel

0
        mAlarmService.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggetRealTimeMillis,
                mUpdateIdleMaintenanceStatePendingIntent);
    } 
 
    private void unscheduleUpdateIdleMaintenanceState() { 
        mAlarmService.cancel(mUpdateIdleMaintenanceStatePendingIntent);
    } 
 
    private void updateIdleMaintenanceState() { 
        if (mIdleMaintenanceStarted) {
            // Idle maintenance can be interrupted by user activity, or duration 
            // time out, or low battery. 
            if (!lastUserActivityPermitsIdleMaintenanceRunning() 
                    || !batteryLevelAndMaintenanceTimeoutPermitsIdleMaintenanceRunning()) { 
                unscheduleUpdateIdleMaintenanceState(); 
                mIdleMaintenanceStarted = false;
                EventLogTags.writeIdleMaintenanceWindowFinish(SystemClock.elapsedRealtime(),
                        mLastUserActivityElapsedTimeMillis, mBatteryService.getBatteryLevel(),
                        isBatteryCharging() ? 1 : 0); 
                sendIdleMaintenanceEndIntent(); 
                // We stopped since we don't have enough battery or timed out but the