Is there a library on Android that checks network status in real time or periodically?

Asked 2 years ago, Updated 2 years ago, 134 views

3G data is intermittently disconnected or Socket is not connected and socket timeout or connection excitation is coming out. I don't believe you. Most of the time, it looks like a shaded area Is there a library or a way to check the network status in detail? Please reply.

ps. 3G connection status and ping check logic are included.

android library

2022-09-22 19:20

1 Answers

https://developer.android.com/training/monitoring-device-state/connectivity-monitoring#MonitorChanges

Once you look at this part, you can get a broadcast receiver for the state of your network connection.

Register the receiver and work according to the network environment.

I don't know if your app is periodically networking or pressed by people, but if you create and run a network worker and it goes down in the middle, you can pause it, activate the network, and then run it again.

There are many ways to operate your network in the background. https://developers-kr.googleblog.com/2018/12/modern-background-execution-in-android.html I think you can refer to this.


2022-09-22 19:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.