mobile/android/base/background/announcements/AnnouncementsBroadcastReceiver.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/background/announcements/AnnouncementsBroadcastReceiver.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +package org.mozilla.gecko.background.announcements;
     1.9 +
    1.10 +import org.mozilla.gecko.background.BackgroundService;
    1.11 +
    1.12 +import android.content.BroadcastReceiver;
    1.13 +import android.content.Context;
    1.14 +import android.content.Intent;
    1.15 +
    1.16 +/**
    1.17 + * Watch for notifications to start the announcements service.
    1.18 + *
    1.19 + * Some observations:
    1.20 + *
    1.21 + * "Also note that as of Android 3.0 the user needs to have started the
    1.22 + *  application at least once before your application can receive
    1.23 + *  android.intent.action.BOOT_COMPLETED events."
    1.24 + */
    1.25 +public class AnnouncementsBroadcastReceiver extends BroadcastReceiver {
    1.26 +
    1.27 +  /**
    1.28 +   * Forward the intent to an IntentService to do background processing.
    1.29 +   */
    1.30 +  @Override
    1.31 +  public void onReceive(Context context, Intent intent) {
    1.32 +    if (AnnouncementsConstants.DISABLED) {
    1.33 +      return;
    1.34 +    }
    1.35 +
    1.36 +    BackgroundService.runIntentInService(context, intent, AnnouncementsBroadcastService.class);
    1.37 +  }
    1.38 +}

mercurial