Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnected status when the application is in the background #8

Open
marcusgregory opened this issue Apr 2, 2020 · 5 comments
Open

Comments

@marcusgregory
Copy link

DataConnectionChecker().onStatusChange.listen always returns 'DataConnectionStatus.disconnected ' status when the application is in the background.

@prasantco
Copy link

Yes i agree with @marcusgregory, i'm also facing this issue.

@aghanti7
Copy link

aghanti7 commented Jul 4, 2020

@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?

@marcusgregory
Copy link
Author

marcusgregory commented Jul 7, 2020

@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;
      }
    });

@Kishan-Somaiya
Copy link

I've same issue, do you got any solution for this ? @marcusgregory

@marcusgregory
Copy link
Author

Still no solution for this problem @Kishan-Somaiya.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants