Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Up and Down Speed in android #147

Open
venky-vc02 opened this issue Jun 2, 2022 · 0 comments
Open

Network Up and Down Speed in android #147

venky-vc02 opened this issue Jun 2, 2022 · 0 comments

Comments

@venky-vc02
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant