Trying this:
Amplify.Hub.subscribe(
HubChannel.DATASTORE,
{ it.name == DataStoreChannelEventName.NETWORK_STATUS.toString() },
{
val networkStatus = it.data as NetworkStatusEvent
Log.i(tag, "User has a network connection? ${networkStatus.active}")
if (networkStatus.active) {
// synchronize after active status
launchEvent(MainEvent.SyncDatabase)
}
}
)
It detects when i activate airplane mode, but not when I deactivate it