summaryrefslogtreecommitdiffstats
path: root/mobile/android/base/java/org/mozilla/gecko/feeds/FeedAlarmReceiver.java
blob: d943b4f81c23353ba8f5cdfafcd8cb59ad3cc84c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.gecko.feeds;

import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;

/**
 * Broadcast receiver that will receive broadcasts from the AlarmManager and start the FeedService
 * with the given action.
 */
public class FeedAlarmReceiver extends WakefulBroadcastReceiver {
    private static final String LOGTAG = "FeedCheckAction";

    @Override
    public void onReceive(Context context, Intent intent) {
        final String action = intent.getAction();

        Log.d(LOGTAG, "Received alarm with action: " + action);

        final Intent serviceIntent = new Intent(context, FeedService.class);
        serviceIntent.setAction(action);

        startWakefulService(context, serviceIntent);
    }
}