1

My App is built on Ionic V1, I have added Network info plugin for detecting an Internet connection. https://github.com/apache/cordova-plugin-network-information

But the problem is it doesn't address the case of slow networks. Is there a way to detect that.

BTW I'm using angular-fire which in turn uses WebSocket (I guess) so timeouts with $http cannot be feasible in this case (Even though I perform some $http calls).

Any inputs will be appreciated.

Sharan Mohandas
  • 861
  • 1
  • 9
  • 25

1 Answers1

2

Using the following Cordova plugin you can measure the type of connections your device is making use and based upon that you could do actions.

states[Connection.UNKNOWN]  = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI]     = 'WiFi connection';
states[Connection.CELL_2G]  = 'Cell 2G connection';
states[Connection.CELL_3G]  = 'Cell 3G connection';
states[Connection.CELL_4G]  = 'Cell 4G connection';
states[Connection.CELL]     = 'Cell generic connection';
states[Connection.NONE]     = 'No network connection';

If for example you pick CELL_2G it will represent the following speed

2G Data Transmission Capacity: With General Packet Radio Service (GPRS), there is a theoretical maximum transfer speed of 50 kbit/s (40 kbit/s in practice). With EDGE (Enhanced Data Rates for GSM Evolution), there is a theoretical maximum transfer speed of 1 Mbit/s (500 kbit/s in practice).

0x1ad2
  • 8,014
  • 9
  • 35
  • 48
  • 1
    But what if he is connected to Wifi but has poor speed? – Sharan Mohandas Mar 27 '17 at 10:38
  • Any other solution for slow wifi? Web service response is very slow due to slow internet connection so data is not loading properly. – Anjana Sep 14 '17 at 09:07
  • @Anjana-Systematix what's the response rate of the server, try to optimize this after that look into service workers https://developers.google.com/web/fundamentals/getting-started/primers/service-workers at least if it's an PWA – 0x1ad2 Sep 14 '17 at 11:49