diff -r 000000000000 -r 6474c204b198 mobile/android/base/fxa/receivers/FxAccountDeletedReceiver.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mobile/android/base/fxa/receivers/FxAccountDeletedReceiver.java Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,33 @@ +/* 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.fxa.receivers; + +import org.mozilla.gecko.background.common.log.Logger; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class FxAccountDeletedReceiver extends BroadcastReceiver { + public static final String LOG_TAG = FxAccountDeletedReceiver.class.getSimpleName(); + + /** + * This receiver can be killed as soon as it returns, but we have things to do + * that can't be done on the main thread (network activity). Therefore we + * start a service to do our clean up work for us, with Android doing the + * heavy lifting for the service's lifecycle. + *
+ * See the Android documentation + * for details. + */ + @Override + public void onReceive(final Context context, Intent broadcastIntent) { + Logger.debug(LOG_TAG, "FxAccount deleted broadcast received."); + + Intent serviceIntent = new Intent(context, FxAccountDeletedService.class); + serviceIntent.putExtras(broadcastIntent); + context.startService(serviceIntent); + } +}