Hello !!! Does anyone know how to programmatically check the speed of the Internet connection on Android? I want to tell the user something like this << Your Internet speed x Mbps >> but how to get << x >>?

  • There is such a library github.com/akinaru/speed-test-lib can help - Andrey Kasyanov
  • Is it possible to dynamically check? That is, every second to find out the current speed? - Salut Amigo
  • @SalutAmigo can find out the current download speed. Look, for example, at 2ip.ru — it takes more than one second to check the Internet speed, moreover, for the time of the check, they are asked to close other tabs and connections. - Trymount

2 answers 2

For this you need to measure it. The approach is as follows:

  1. Get the timestamp to start the download.
  2. Download a file of a known size from the server.
  3. Get the timestamp to complete the download.
  4. Compare and calculate, based on the file size.

    This will give you the speed of the incoming channel. Then the same file is returned to the server and calculate the speed of the outgoing channel.

  • Is it possible to dynamically check? That is, every second to find out the current speed? - Salut Amigo
  • You can find out the current channel load. Or find out the speed at which the connection is established with the gateway. But this will have a little more to the actual available Internet speed than none. - Alexandr Blinov

Facebook has a wonderful Network Connection Class library that will help you get things done.

  • Is it possible to dynamically check? That is, every second to find out the current speed? - Salut Amigo