|
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/. */ |
|
4 |
|
5 package org.mozilla.gecko.sync.receivers; |
|
6 |
|
7 import org.mozilla.gecko.background.common.log.Logger; |
|
8 |
|
9 import android.content.BroadcastReceiver; |
|
10 import android.content.Context; |
|
11 import android.content.Intent; |
|
12 |
|
13 public class SyncAccountDeletedReceiver extends BroadcastReceiver { |
|
14 public static final String LOG_TAG = "SyncAccountDeletedReceiver"; |
|
15 |
|
16 /** |
|
17 * This receiver can be killed as soon as it returns, but we have things to do |
|
18 * that can't be done on the main thread (network activity). Therefore we |
|
19 * start a service to do our clean up work for us, with Android doing the |
|
20 * heavy lifting for the service's lifecycle. |
|
21 * <p> |
|
22 * See <a href="http://developer.android.com/reference/android/content/BroadcastReceiver.html#ReceiverLifecycle">the Android documentation</a> |
|
23 * for details. |
|
24 */ |
|
25 @Override |
|
26 public void onReceive(final Context context, Intent broadcastIntent) { |
|
27 Logger.debug(LOG_TAG, "Sync Account Deleted broadcast received."); |
|
28 |
|
29 Intent serviceIntent = new Intent(context, SyncAccountDeletedService.class); |
|
30 serviceIntent.putExtras(broadcastIntent); |
|
31 context.startService(serviceIntent); |
|
32 } |
|
33 } |