mobile/android/base/background/healthreport/HealthReportBroadcastReceiver.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 package org.mozilla.gecko.background.healthreport;
     7 import org.mozilla.gecko.background.common.log.Logger;
     9 import android.content.BroadcastReceiver;
    10 import android.content.Context;
    11 import android.content.Intent;
    13 /**
    14  * Watch for notifications to start Health Report background services.
    15  *
    16  * Some observations:
    17  *
    18  * From the Android documentation: "Also note that as of Android 3.0 the user
    19  * needs to have started the application at least once before your application
    20  * can receive android.intent.action.BOOT_COMPLETED events."
    21  *
    22  * We really do want to launch on BOOT_COMPLETED, since it's possible for a user
    23  * to run Firefox, shut down the phone, then power it on again on the same day.
    24  * We want to submit a health report in this case, even though they haven't
    25  * launched Firefox since boot.
    26  */
    27 public class HealthReportBroadcastReceiver extends BroadcastReceiver {
    28   public static final String LOG_TAG = HealthReportBroadcastReceiver.class.getSimpleName();
    30   /**
    31    * Forward the intent to an IntentService to do background processing.
    32    */
    33   @Override
    34   public void onReceive(Context context, Intent intent) {
    35     Logger.debug(LOG_TAG, "Received intent - forwarding to BroadcastService.");
    36     Intent service = new Intent(context, HealthReportBroadcastService.class);
    37     service.putExtras(intent);
    38     service.setAction(intent.getAction());
    39     context.startService(service);
    40   }
    41 }

mercurial