Package dagger.android
Class DaggerBroadcastReceiver
- java.lang.Object
-
- android.content.BroadcastReceiver
-
- dagger.android.DaggerBroadcastReceiver
-
@Beta public abstract class DaggerBroadcastReceiver extends android.content.BroadcastReceiver
ABroadcastReceiver
that injects its members in every call toonReceive(Context, Intent)
.This class should only be used for
BroadcastReceiver
s that are declared in anAndroidManifest.xml
. If, instead, theBroadcastReceiver
is created in code, prefer constructor injection.Note: this class is not thread safe and should not be used with multiple
Handler
s in calls toContext.registerReceiver(BroadcastReceiver, android.content.IntentFilter, String, android.os.Handler)
. Injection is performed on each invocation toonReceive(Context, Intent)
which could result in inconsistent views of injected dependencies across threads.Subclasses should override
onReceive(Context, Intent)
and callsuper.onReceive(context, intent)
immediately to ensure injection is performed immediately.
-
-
Constructor Summary
Constructors Constructor Description DaggerBroadcastReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onReceive(android.content.Context context, android.content.Intent intent)
-
Methods inherited from class android.content.BroadcastReceiver
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
-
-