Example usage for android.content Context ALARM_SERVICE

List of usage examples for android.content Context ALARM_SERVICE

Introduction

In this page you can find the example usage for android.content Context ALARM_SERVICE.

Prototype

String ALARM_SERVICE

To view the source code for android.content Context ALARM_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.app.AlarmManager for receiving intents at a time of your choosing.

Usage

From source file:org.apps8os.motivator.services.NotificationService.java

@Override
protected void onHandleIntent(Intent intent) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    if (prefs.getBoolean(SettingsActivity.KEY_SEND_NOTIFICATIONS, true)) {
        // Set up the notification with a builder
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        Bundle extras = intent.getExtras();

        // Check the notification type.
        int notificationType = extras.getInt(NOTIFICATION_TYPE);
        if (notificationType == NOTIFICATION_MOOD) {
            // Cancel all previous notifications.
            manager.cancelAll();/*www.ja  v a  2s . c  o m*/

            SprintDataHandler dataHandler = new SprintDataHandler(this);
            Sprint currentSprint = dataHandler.getCurrentSprint();
            AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
            // If there is no current sprint, cancel alarms.
            if (currentSprint == null) {
                Sprint latestEndedSprint = dataHandler.getLatestEndedSprint();
                if (latestEndedSprint != null) {
                    if (latestEndedSprint.endedYesterday()) {
                        builder.setContentTitle(getString(R.string.completed_sprint));
                        builder.setSmallIcon(R.drawable.ic_stat_notification_icon_1);
                        builder.setAutoCancel(true);
                        Intent resultIntent = new Intent(this, MainActivity.class);
                        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
                        stackBuilder.addParentStack(MainActivity.class);
                        stackBuilder.addNextIntent(resultIntent);
                        PendingIntent pendingResultIntent = stackBuilder.getPendingIntent(0,
                                PendingIntent.FLAG_CANCEL_CURRENT);
                        builder.setContentIntent(pendingResultIntent);
                        manager.notify(NOTIFICATION_ID_SPRINT_ENDED, builder.build());
                    }
                }
                Intent notificationIntent = new Intent(this, NotificationService.class);
                PendingIntent pendingNotificationIntent = PendingIntent.getService(this, 0, notificationIntent,
                        PendingIntent.FLAG_CANCEL_CURRENT);
                alarmManager.cancel(pendingNotificationIntent);
            } else {
                builder.setContentTitle(getString(R.string.today_screen_mood));
                int currentDateInSprint = currentSprint.getCurrentDayOfTheSprint();

                builder.setSmallIcon(R.drawable.ic_stat_notification_icon_1);
                // Remove the notification when the user clicks it.
                builder.setAutoCancel(true);

                // Where to go when user clicks the notification
                Intent resultIntent = new Intent(this, MoodQuestionActivity.class);
                DayDataHandler moodDataHandler = new DayDataHandler(this);

                // Check if there were events yesterday.
                DayInHistory yesterday = moodDataHandler.getDayInHistory(
                        System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS));
                yesterday.setEvents();
                ArrayList<MotivatorEvent> yesterdayEvents = yesterday.getUncheckedEvents(this);
                if (!yesterdayEvents.isEmpty()) {
                    // Put the events as extras to the intent so that we can pass them to the checking activity.
                    resultIntent.putExtra(MotivatorEvent.YESTERDAYS_EVENTS, yesterdayEvents);
                    resultIntent.putExtra(EventDataHandler.EVENTS_TO_CHECK, true);
                    builder.setContentText(getString(R.string.you_had_an_event_yesterday));
                } else {
                    // No events to check.
                    resultIntent.putExtra(EventDataHandler.EVENTS_TO_CHECK, false);
                    EventDataHandler eventHandler = new EventDataHandler(this);
                    long lastAddedEventTimestamp = eventHandler.getLatestAddedEventTimestamp();
                    if (lastAddedEventTimestamp != 0L && System.currentTimeMillis()
                            - lastAddedEventTimestamp > TimeUnit.MILLISECONDS.convert(7, TimeUnit.DAYS)) {
                        builder.setContentText(getString(R.string.plan_reminder));
                    } else {
                        builder.setContentText(getString(R.string.today_is_the_day) + " " + currentDateInSprint
                                + "/" + currentSprint.getDaysInSprint() + " - "
                                + currentSprint.getSprintTitle());
                    }
                }
                // Preserve the normal navigation of the app by adding the parent stack of the result activity
                TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
                stackBuilder.addParentStack(MoodQuestionActivity.class);
                stackBuilder.addNextIntent(resultIntent);
                PendingIntent pendingResultIntent = stackBuilder.getPendingIntent(0,
                        PendingIntent.FLAG_CANCEL_CURRENT);
                builder.setContentIntent(pendingResultIntent);
                manager.notify(NOTIFICATION_ID_MOOD, builder.build());
            }
        }

        else if (notificationType == NOTIFICATION_EVENT_START) {
            // Set up a notification for the start of an event.
            int eventId = extras.getInt(EventDataHandler.EVENT_ID);
            String eventName = extras.getString(EventDataHandler.EVENT_NAME);
            builder.setContentTitle(getString(R.string.you_have_an_event_starting));
            builder.setContentText(eventName);
            builder.setSmallIcon(R.drawable.ic_stat_notification_icon_1);
            // Remove the notification when the user clicks it.
            builder.setAutoCancel(true);

            Intent resultIntent = new Intent(this, EventDetailsActivity.class);
            resultIntent.putExtra(EventDataHandler.EVENT_ID, eventId);
            TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
            stackBuilder.addParentStack(EventDetailsActivity.class);
            stackBuilder.addNextIntent(resultIntent);
            PendingIntent pendingResultIntent = stackBuilder.getPendingIntent(0,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            builder.setContentIntent(pendingResultIntent);

            manager.notify(eventId, builder.build());
        }

        else if (notificationType == NOTIFICATION_EVENT_END) {
            // Set up a notification for the start of an event.
            int eventId = extras.getInt(EventDataHandler.EVENT_ID);
            builder.setContentTitle(getString(R.string.event_ending));
            builder.setContentText(getString(R.string.go_home));
            builder.setSmallIcon(R.drawable.ic_stat_notification_icon_1);
            // Remove the notification when the user clicks it.
            builder.setAutoCancel(true);

            Intent resultIntent = new Intent(this, EventDetailsActivity.class);
            resultIntent.putExtra(EventDataHandler.EVENT_ID, eventId);
            TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
            stackBuilder.addParentStack(EventDetailsActivity.class);
            stackBuilder.addNextIntent(resultIntent);
            PendingIntent pendingResultIntent = stackBuilder.getPendingIntent(0,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            builder.setContentIntent(pendingResultIntent);

            manager.notify(eventId + 10000, builder.build());
        }
    }
}

From source file:com.appsaur.tarucassist.AutomuteAlarmReceiver.java

public void setRepeatAlarm(Context context, Calendar calendar, int ID, long RepeatTime) {
    mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

    // Put Reminder ID in Intent Extra
    Intent intent = new Intent(context, AutomuteAlarmReceiver.class);
    intent.putExtra(BaseActivity.EXTRA_REMINDER_ID, Integer.toString(ID));
    mPendingIntent = PendingIntent.getBroadcast(context, ID, intent, PendingIntent.FLAG_CANCEL_CURRENT);

    // Calculate notification timein
    Calendar c = Calendar.getInstance();
    long currentTime = c.getTimeInMillis();
    long diffTime = calendar.getTimeInMillis() - currentTime;

    // Start alarm using initial notification time and repeat interval time
    mAlarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + diffTime,
            RepeatTime, mPendingIntent);

    // Restart alarm if device is rebooted
    ComponentName receiver = new ComponentName(context, BootReceiver.class);
    PackageManager pm = context.getPackageManager();
    pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
            PackageManager.DONT_KILL_APP);
}

From source file:com.jerrellmardis.amphitheatre.util.Utils.java

public static void scheduleLibraryUpdateService(Context context) {
    Log.d("amp:Utils",
            "Checking if alarm is already set: " + isAlarmAlreadySet(context, LibraryUpdateService.class));
    //And now/*from w  ww  .j av a2  s  .  co m*/
    Log.d("amp:Utils", "Start rechecking the library");
    Intent intent = new Intent(context, LibraryUpdateService.class);
    intent.putExtra("ALARM", true);
    /*context.startService(intent);*/
    if (isAlarmAlreadySet(context, LibraryUpdateService.class))
        return;

    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    //Intent intent = ...
    PendingIntent alarmIntent = PendingIntent.getService(context, LIBRARY_UPDATE_REQUEST_CODE, intent, 0);

    alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, AlarmManager.INTERVAL_HALF_HOUR,
            AlarmManager.INTERVAL_HOUR * 3, //Every three hours seems sufficient
            alarmIntent);

}

From source file:com.github.jvanhie.discogsscrobbler.util.NowPlayingService.java

@Override
public void onCreate() {
    super.onCreate();
    mDiscogs = Discogs.getInstance(this);
    mLastfm = Lastfm.getInstance(this);

    //create universal image loader
    mImageLoader = ImageLoader.getInstance();
    DisplayImageOptions options = new DisplayImageOptions.Builder().showStubImage(R.drawable.default_release)
            .cacheInMemory().build();/*from   w  w w  . j  a v  a2  s  .c o  m*/
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).enableLogging()
            .defaultDisplayImageOptions(options).build();
    mImageLoader.init(config);

    mNotificationBuilder = new NotificationCompat.Builder(this).setContentIntent(
            PendingIntent.getActivity(this, 0, new Intent(this, NowPlayingActivity.class), 0));

    mAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
}

From source file:org.bwgz.quotation.service.QuotationService.java

@Override
protected void onHandleIntent(Intent intent) {
    Log.d(TAG, String.format("onHandleIntent - intent: %s (%s)", intent, new Date().toString()));

    SharedPreferences preferences = getSharedPreferences(QuotationApplication.APPLICATION_PREFERENCES,
            Context.MODE_PRIVATE);
    long modified = preferences.getLong(QuotationApplication.APPLICATION_PREFERENCE_QUOTATION_PICKS_MODIFIED,
            0);//  w  w  w .  j  a  va2  s  . c  om

    if (modified + PICKS_PERIOD < System.currentTimeMillis()) {
        getContentResolver().delete(PickQuotation.CONTENT_URI, null, null);
        getContentResolver().delete(PickPerson.CONTENT_URI, null, null);
        getContentResolver().delete(PickSubject.CONTENT_URI, null, null);

        FreebaseIdLoader freebaseIdLoader = FreebaseIdLoader.getInstance(getApplicationContext());
        List<Pick> quotationPicks = freebaseIdLoader.getRandomQuotationPicks(PICK_SIZE);
        List<Pick> authorPicks = freebaseIdLoader.getRandomAuthorPicks(PICK_SIZE);
        List<Pick> subjectPicks = freebaseIdLoader.getRandomSubjectPicks(PICK_SIZE);

        for (int i = 0; i < PICK_SIZE; i++) {
            getContentResolver()
                    .query(PickQuotation.withAppendedId(quotationPicks.get(i).getId()), null, null, null, null)
                    .close();
            getContentResolver()
                    .query(PickPerson.withAppendedId(authorPicks.get(i).getId()), null, null, null, null)
                    .close();
            getContentResolver()
                    .query(PickSubject.withAppendedId(subjectPicks.get(i).getId()), null, null, null, null)
                    .close();
        }

        SharedPreferences.Editor editor = preferences.edit();
        modified = System.currentTimeMillis();
        editor.putLong(QuotationApplication.APPLICATION_PREFERENCE_QUOTATION_PICKS_MODIFIED, modified);
        editor.putLong(QuotationApplication.APPLICATION_PREFERENCE_PERSON_PICKS_MODIFIED, modified);
        editor.putLong(QuotationApplication.APPLICATION_PREFERENCE_SUBJECT_PICKS_MODIFIED, modified);
        editor.commit();
    }

    AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
            new Intent(this, QuotationAlarmReceiver.class), 0);
    alarmManager.cancel(alarmIntent);

    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.set(Calendar.HOUR_OF_DAY, 2);
    calendar.set(Calendar.MINUTE, random.nextInt(60));
    calendar.set(Calendar.SECOND, random.nextInt(60));
    alarmManager.set(AlarmManager.RTC, calendar.getTimeInMillis() + PICKS_PERIOD, alarmIntent);

    LocalBroadcastManager.getInstance(this)
            .sendBroadcast(new Intent(BROADCAST_ACTION).putExtra(EXTENDED_DATA_STATUS, true));
}

From source file:co.carlosandresjimenez.android.gotit.notification.AlarmReceiver.java

/**
 * Sets a repeating alarm that runs once a day at approximately 8:30 a.m. When the
 * alarm fires, the app broadcasts an Intent to this WakefulBroadcastReceiver.
 *
 * @param context/*from w ww  .  j a  v a 2s.c om*/
 */
public void setAlarm(Context context) {

    // If the alarm has been set, cancel it.
    if (alarmMgr != null) {
        alarmIntent.cancel();
        alarmMgr.cancel(alarmIntent);
    }

    alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    Intent intent = new Intent(context, AlarmReceiver.class);
    alarmIntent = PendingIntent.getBroadcast(context, 0, intent, 0);

    int userFrequencySetting = Utility.getNotificationFrequency(context);

    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.add(Calendar.HOUR, userFrequencySetting);

    // Set the alarm to fire in X hours according to the device's
    // clock and user settings, and to repeat according to user settings
    alarmMgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
            userFrequencySetting * ONE_HOUR_MILLISECONDS, alarmIntent);

    ComponentName receiver = new ComponentName(context, BootReceiver.class);
    PackageManager pm = context.getPackageManager();

    pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
            PackageManager.DONT_KILL_APP);
}

From source file:com.nick.scalpel.core.AutoFoundWirer.java

private void wireFromContext(Context context, AutoFound.Type type, int idRes, Resources.Theme theme,
        Field field, Object forWho) {
    Resources resources = context.getResources();
    switch (type) {
    case STRING://  w  w  w  .  j  a  v a  2 s .c  o  m
        setField(field, forWho, resources.getString(idRes));
        break;
    case COLOR:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            setField(field, forWho, resources.getColor(idRes, theme));
        } else {
            //noinspection deprecation
            setField(field, forWho, resources.getColor(idRes));
        }
        break;
    case INTEGER:
        setField(field, forWho, resources.getInteger(idRes));
        break;
    case BOOL:
        setField(field, forWho, resources.getBoolean(idRes));
        break;
    case STRING_ARRAY:
        setField(field, forWho, resources.getStringArray(idRes));
        break;
    case INT_ARRAY:
        setField(field, forWho, resources.getIntArray(idRes));
        break;
    case PM:
        setField(field, forWho, context.getSystemService(Context.POWER_SERVICE));
        break;
    case ACCOUNT:
        setField(field, forWho, context.getSystemService(Context.ACCOUNT_SERVICE));
        break;
    case ALARM:
        setField(field, forWho, context.getSystemService(Context.ALARM_SERVICE));
        break;
    case AM:
        setField(field, forWho, context.getSystemService(Context.ACTIVITY_SERVICE));
        break;
    case WM:
        setField(field, forWho, context.getSystemService(Context.WINDOW_SERVICE));
        break;
    case NM:
        setField(field, forWho, context.getSystemService(Context.NOTIFICATION_SERVICE));
        break;
    case TM:
        setField(field, forWho, context.getSystemService(Context.TELEPHONY_SERVICE));
        break;
    case TCM:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setField(field, forWho, context.getSystemService(Context.TELECOM_SERVICE));
        }
        break;
    case SP:
        setField(field, forWho, PreferenceManager.getDefaultSharedPreferences(context));
        break;
    case PKM:
        setField(field, forWho, context.getPackageManager());
        break;
    case HANDLE:
        setField(field, forWho, new Handler(Looper.getMainLooper()));
        break;
    case ASM:
        setField(field, forWho, context.getSystemService(Context.ACCESSIBILITY_SERVICE));
        break;
    case CAP:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setField(field, forWho, context.getSystemService(Context.CAPTIONING_SERVICE));
        }
        break;
    case KGD:
        setField(field, forWho, context.getSystemService(Context.KEYGUARD_SERVICE));
        break;
    case LOCATION:
        setField(field, forWho, context.getSystemService(Context.LOCATION_SERVICE));
        break;
    case SEARCH:
        setField(field, forWho, context.getSystemService(Context.SEARCH_SERVICE));
        break;
    case SENSOR:
        setField(field, forWho, context.getSystemService(Context.SENSOR_SERVICE));
        break;
    case STORAGE:
        setField(field, forWho, context.getSystemService(Context.STORAGE_SERVICE));
        break;
    case WALLPAPER:
        setField(field, forWho, context.getSystemService(Context.WALLPAPER_SERVICE));
        break;
    case VIBRATOR:
        setField(field, forWho, context.getSystemService(Context.VIBRATOR_SERVICE));
        break;
    case CONNECT:
        setField(field, forWho, context.getSystemService(Context.CONNECTIVITY_SERVICE));
        break;
    case NETWORK_STATUS:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            setField(field, forWho, context.getSystemService(Context.NETWORK_STATS_SERVICE));
        }
        break;
    case WIFI:
        setField(field, forWho, context.getSystemService(Context.WIFI_SERVICE));
        break;
    case AUDIO:
        setField(field, forWho, context.getSystemService(Context.AUDIO_SERVICE));
        break;
    case FP:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            setField(field, forWho, context.getSystemService(Context.FINGERPRINT_SERVICE));
        }
        break;
    case MEDIA_ROUTER:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            setField(field, forWho, context.getSystemService(Context.MEDIA_ROUTER_SERVICE));
        }
        break;
    case SUB:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
            setField(field, forWho, context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE));
        }
        break;
    case IME:
        setField(field, forWho, context.getSystemService(Context.INPUT_METHOD_SERVICE));
        break;
    case CLIP_BOARD:
        setField(field, forWho, context.getSystemService(Context.CLIPBOARD_SERVICE));
        break;
    case APP_WIDGET:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setField(field, forWho, context.getSystemService(Context.APPWIDGET_SERVICE));
        }
        break;
    case DEVICE_POLICY:
        setField(field, forWho, context.getSystemService(Context.DEVICE_POLICY_SERVICE));
        break;
    case DOWNLOAD:
        setField(field, forWho, context.getSystemService(Context.DOWNLOAD_SERVICE));
        break;
    case BATTERY:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setField(field, forWho, context.getSystemService(Context.BATTERY_SERVICE));
        }
        break;
    case NFC:
        setField(field, forWho, context.getSystemService(Context.NFC_SERVICE));
        break;
    case DISPLAY:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            setField(field, forWho, context.getSystemService(Context.DISPLAY_SERVICE));
        }
        break;
    case USER:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            setField(field, forWho, context.getSystemService(Context.USER_SERVICE));
        }
        break;
    case APP_OPS:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setField(field, forWho, context.getSystemService(Context.APP_OPS_SERVICE));
        }
        break;
    case BITMAP:
        setField(field, forWho, BitmapFactory.decodeResource(resources, idRes, null));
        break;
    }
}

From source file:com.piggate.samples.PiggateLoginService.Service_Notify.java

@Override
public void onTaskRemoved(Intent rootIntent) {
    Intent restartService = new Intent(getApplicationContext(), this.getClass());
    restartService.setPackage(getPackageName());
    PendingIntent restartServicePI = PendingIntent.getService(getApplicationContext(), 1, restartService,
            PendingIntent.FLAG_ONE_SHOT);
    AlarmManager alarmService = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
    alarmService.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 1000, restartServicePI);
}

From source file:com.eggwall.AdkUnoUsbHostExample.control.AccessoryService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (mNotificationManager == null) {
        mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    }/*from w  w w . j a  v  a2  s.c om*/
    if (mAlarmManager == null) {
        mAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    }

    // If we don't get an extra (impossible), start the service.
    int request = intent.getIntExtra(REQUEST_EXTRA_NAME, REQUEST_START);
    if (request == REQUEST_START) {
        if (mNetwork == null && mControl == null) {
            createAccessory();
            return START_NOT_STICKY;
        }
    } else {
        handleRequest(request);
    }
    return START_NOT_STICKY;
}

From source file:com.sean.takeastand.alarmprocess.UnscheduledRepeatingAlarm.java

@Override
public void pause() {
    //Cancel previous
    PendingIntent pendingIntent = createPendingIntent(mContext);
    AlarmManager am = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    am.cancel(pendingIntent);/* w  ww.j ava  2 s. c o m*/
    endAlarmService();
    int totalPauseTime = Utils.getDefaultPauseAmount(mContext);
    long delayTimeInMillis = totalPauseTime * Constants.secondsInMinute * Constants.millisecondsInSecond;
    long triggerTime = SystemClock.elapsedRealtime() + delayTimeInMillis;
    PendingIntent pausePendingIntent = createPausePendingIntent(mContext);
    am.set(AlarmManager.ELAPSED_REALTIME, triggerTime, pausePendingIntent);
    Calendar pausedUntilTime = Calendar.getInstance();
    pausedUntilTime.add(Calendar.MINUTE, Utils.getDefaultPauseAmount(mContext));
    Utils.setPausedTime(pausedUntilTime, mContext);
    Utils.setImageStatus(mContext, Constants.NON_SCHEDULE_PAUSED);
}