public class ConnectivityReceiver
extends android.content.BroadcastReceiver
Modifier and Type | Method | Description |
---|---|---|
void |
activate() |
Activates the connectivity receiver.
|
void |
addListener(ConnectivityListener listener) |
Add a listener to be notified
|
void |
deactivate() |
Deactivates the connectivity receiver.
|
static ConnectivityReceiver |
instance(android.content.Context context) |
Get a single instance of ConnectivityReceiver.
|
boolean |
isConnected() |
Get current connectivity state
|
void |
onReceive(android.content.Context context,
android.content.Intent intent) |
|
void |
removeListener(ConnectivityListener listener) |
Remove a listener
|
void |
setConnected(java.lang.Boolean connected) |
Overwrites system connectivity state.
|
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
public static ConnectivityReceiver instance(@NonNull android.content.Context context)
context
- the context to extract the application context from@UiThread public void activate()
if the underlying connectivity receiver isn't active, register the connectivity receiver.
@UiThread public void deactivate()
if no other components are listening, unregister the underlying connectivity receiver.
public void onReceive(@NonNull android.content.Context context, android.content.Intent intent)
onReceive
in class android.content.BroadcastReceiver
public void setConnected(java.lang.Boolean connected)
TrimbleMaps.setConnected(Boolean)
.connected
- flag to determine the connectivity state, true for connected, false for
disconnected, and null for ConnectivityManager to determine.public void addListener(@NonNull ConnectivityListener listener)
listener
- the listener to addpublic void removeListener(@NonNull ConnectivityListener listener)
listener
- the listener to removepublic boolean isConnected()