-
- All Implemented Interfaces:
-
io.sentry.IConnectionStatusProvider
@ApiStatus.Internal() public final class AndroidConnectionStatusProvider implements IConnectionStatusProviderNote: ConnectivityManager sometimes throws SecurityExceptions on Android 11. Hence all relevant calls are guarded with try/catch. see https://issuetracker.google.com/issues/175055271 for more details
-
-
Field Summary
Fields Modifier and Type Field Description private volatile ConnectivityManager.NetworkCallbacknetworkCallback
-
Constructor Summary
Constructors Constructor Description AndroidConnectionStatusProvider(Context context, ILogger logger, BuildInfoProvider buildInfoProvider)
-
Method Summary
Modifier and Type Method Description ConnectivityManager.NetworkCallbackgetNetworkCallback()IConnectionStatusProvider.ConnectionStatusgetConnectionStatus()StringgetConnectionType()booleanaddConnectionStatusObserver(@NotNull() IConnectionStatusProvider.IConnectionStatusObserver observer)voidremoveConnectionStatusObserver(@NotNull() IConnectionStatusProvider.IConnectionStatusObserver observer)static StringgetConnectionType(@NotNull() Context context, @NotNull() ILogger logger, @NotNull() BuildInfoProvider buildInfoProvider)Check the connection type of the active network static StringgetConnectionType(@NotNull() NetworkCapabilities networkCapabilities)Check the connection type of the active network static booleanregisterNetworkCallback(@NotNull() Context context, @NotNull() ILogger logger, @NotNull() BuildInfoProvider buildInfoProvider, @NotNull() ConnectivityManager.NetworkCallback networkCallback)static voidunregisterNetworkCallback(@NotNull() Context context, @NotNull() ILogger logger, @NotNull() ConnectivityManager.NetworkCallback networkCallback)List<IConnectionStatusProvider.IConnectionStatusObserver>getStatusObservers()-
Methods inherited from class io.sentry.IConnectionStatusProvider
addConnectionStatusObserver, getConnectionStatus, getConnectionType, removeConnectionStatusObserver -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
AndroidConnectionStatusProvider
AndroidConnectionStatusProvider(Context context, ILogger logger, BuildInfoProvider buildInfoProvider)
-
-
Method Detail
-
getNetworkCallback
@TestOnly()@Nullable() ConnectivityManager.NetworkCallback getNetworkCallback()
-
getConnectionStatus
@NotNull() IConnectionStatusProvider.ConnectionStatus getConnectionStatus()
-
getConnectionType
@Nullable() String getConnectionType()
-
addConnectionStatusObserver
boolean addConnectionStatusObserver(@NotNull() IConnectionStatusProvider.IConnectionStatusObserver observer)
-
removeConnectionStatusObserver
void removeConnectionStatusObserver(@NotNull() IConnectionStatusProvider.IConnectionStatusObserver observer)
-
getConnectionType
@Nullable() static String getConnectionType(@NotNull() Context context, @NotNull() ILogger logger, @NotNull() BuildInfoProvider buildInfoProvider)
Check the connection type of the active network
- Parameters:
context- the App.logger- the logger from optionsbuildInfoProvider- the BuildInfoProvider provider
-
getConnectionType
@Nullable() static String getConnectionType(@NotNull() NetworkCapabilities networkCapabilities)
Check the connection type of the active network
- Parameters:
networkCapabilities- the NetworkCapabilities to check the transport type
-
registerNetworkCallback
static boolean registerNetworkCallback(@NotNull() Context context, @NotNull() ILogger logger, @NotNull() BuildInfoProvider buildInfoProvider, @NotNull() ConnectivityManager.NetworkCallback networkCallback)
-
unregisterNetworkCallback
static void unregisterNetworkCallback(@NotNull() Context context, @NotNull() ILogger logger, @NotNull() ConnectivityManager.NetworkCallback networkCallback)
-
getStatusObservers
@TestOnly()@NotNull() List<IConnectionStatusProvider.IConnectionStatusObserver> getStatusObservers()
-
-
-
-