data_connection_checker
data_connection_checker copied to clipboard
Disconnected status when the application is in the background
DataConnectionChecker().onStatusChange.listen always returns 'DataConnectionStatus.disconnected ' status when the application is in the background.
Yes i agree with @marcusgregory, i'm also facing this issue.
@marcusgregory I tried this in debug mode by putting app in the background (AppLifecycleState.paused) and then resuming it (AppLifecycleState.resumed). I did not see this issue. Can you elaborate on the use case you where you are seeing this issue?
@aghanti7 I'm using it this way in my application You can also check my repository
int onlineFlag = 0;
StreamSubscription<DataConnectionStatus> listenConnection;
listenConnection = DataConnectionChecker().onStatusChange.listen((status) {
switch (status) {
case DataConnectionStatus.connected:
if (onlineFlag > 0) {
print('Now is online.');
}
break;
case DataConnectionStatus.disconnected:
onlineFlag++;
print('It is offline.');
break;
}
});
I've same issue, do you got any solution for this ? @marcusgregory
Still no solution for this problem @Kishan-Somaiya.