You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2022/06/02 10:26:50 UTC

[GitHub] [cordova-plugin-network-information] venky-vc02 opened a new issue, #147: Network Up and Down Speed in android

venky-vc02 opened a new issue, #147:
URL: https://github.com/apache/cordova-plugin-network-information/issues/147

   # Feature Request
   Network Speed Detection
   
   ## Motivation Behind Feature
   It will be very useful for those users who would like to know the current network upload and download speed in android.
   
   
   
   ## Feature Description
   
   - Provide the current connected network upload speed
   - Provide the current connected network download speed
   - It will be useful to replace the usage of google speed test to validate who much speed is the internet user connected to.
   - We can return 0 if the current speed cannot be determined or in cases where the internet is not reachable.
   
   
   
   ## Alternatives or Workarounds
   We can use the new method provided by android **NetworkCapabilities**
   ```
   ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
       NetworkInfo netInfo = cm.getActiveNetworkInfo();
       //should check null because in airplane mode it will be null
       NetworkCapabilities nc = cm.getNetworkCapabilities(cm.getActiveNetwork());
       int downSpeed = nc.getLinkDownstreamBandwidthKbps();
       int upSpeed = nc.getLinkUpstreamBandwidthKbps();
   ```
   
   This code will help in getting the speed in kbps.
   
   Check this link for more updates
   [Network Capabilities](https://developer.android.com/reference/android/net/NetworkCapabilities)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org