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

How to check Internet Connection in Background continuously even if App is Running or Not/Closed.. #3

Closed
patelakshay13890 opened this issue Jan 31, 2023 · 1 comment

Comments

@patelakshay13890
Copy link

How Check Internet Connection in Broadcast Receiver or Service Like as we do in Activity ?
But I need in Service or Broadcast Receiver..
Means I need to check Internet Connation in Background continuously even if App is Running or Not/Closed..
As on Internet Connectivity change I want to Sync My Data to Server so please help me out..!!
Thanks..

@raheemadamboev
Copy link
Owner

You can use Jetpack WorkManager for that purpose:

https://developer.android.com/topic/libraries/architecture/workmanager

Check out its constraints, it has constraint to execute the code when there is an internet connection from background.

Here is a good video about it, if you prefer video way of learning: https://www.youtube.com/watch?v=Psc2xyutE2U&t=6s

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

2 participants