apache / apache/cordova-plugin-network-information

Network Up and Down Speed in android

Open
#147 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
465
Forks
339
PR merge metrics
No merged PRs in 30d

Description

# 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)

Contributor guide

Open the contributing guide

Research direction

The issue names no repository file or test; start by locating the Android implementation and the existing network-information API exposed by the plugin. Review Android NetworkCapabilities and confirm how upload and download speeds should be returned, including the requested 0 value when speed or connectivity cannot be determined.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.