Check the quality of wifi connectivity?

前端 未结 2 1187
抹茶落季
抹茶落季 2021-01-06 04:37

I ran into the case that when I had 4G off and connected to certain wifi access point but without capability to send out or receive data, the flag used to check the connecti

2条回答
  •  佛祖请我去吃肉
    2021-01-06 05:02

    For anyone running into this question, here's an answer from Sep 8, 2015

    https://github.com/facebook/network-connection-class

    Network Connection Class

    Network Connection Class is an Android library that allows you to figure out the quality of the current user's internet connection. The connection gets classified into several "Connection Classes" that make it easy to develop against. The library does this by listening to the existing internet traffic done by your app and notifying you when the user's connection quality changes. Developers can then use this Connection Class information and adjust the application's behaviour (request lower quality images or video, throttle type-ahead, etc).

    Network Connection Class currently only measures the user's downstream bandwidth. Latency is also an important factor, but in our tests, we've found that bandwidth is a good proxy for both.

    The Network Connection Class library takes care of spikes using a moving average of the incoming samples, and also applies some hysteresis (both with a minimum number of samples and amount the average has to cross a boundary before triggering a bucket change)

提交回复
热议问题