-2

Can anyone knows, Still my device internet connection is available but there is slow internet connection then How I check for slow internet connection in my android app?

  • https://stackoverflow.com/questions/25309603/effective-way-to-check-for-slow-internet-connection-and-differentiate-between-ne – AskNilesh Apr 16 '18 at 10:21
  • 1
    Possible duplicate of [Detect if Android device has Internet connection](https://stackoverflow.com/questions/6493517/detect-if-android-device-has-internet-connection) – arirawr Apr 16 '18 at 10:48
  • Hey @arirawr how can you say that this is duplicate? This is different question and I am asking different. – Dnyaneshwar Panchal Apr 18 '18 at 08:13

3 Answers3

4

Use this for check the wifi level:

WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
int linkSpeed = wifiManager.getConnectionInfo().getRssi();
int level = WifiManager.calculateSignalLevel(linkSpeed, 5);
Harish Rawal
  • 176
  • 1
  • 14
1

This is not an easy task since Android is able to provide information about the network and its status but not about its effective speed, that depends on a lot of factors. Facebook has released a library that you can find here. Its usage is explained on the readme.

1

For Mobile Internet Data:

For Mobile Data Link you can only check TelefonyManager.getNetworkType() to determine the current Mobile Data Link type. You should then aproximate to actual speed by link type (i.e. for GPRS up to 128 kbps, for EDGE up to 236.8 kpbs, for 3G up to 2 Mbps, for HDSPA up to 7.2 Mbps). Take into consideration that this is only an aproximation. Your could be conneting using HDSPA but your carrier limiting the top speed to 2 Mbps.

For Wifi you can check internet speed using: For WiFi link speed check WifiInfo.getLinkSpeed()

Note: You need to get speed and put condition whether below 100kbps , "low internet connection"

Community
  • 1
  • 1
Lokesh Desai
  • 2,399
  • 13
  • 26