how to get internet speed in android programmatically

Solutions on MaxInterview for how to get internet speed in android programmatically by the best coders in the world

showing results for - "how to get internet speed in android programmatically"
Tim
04 Nov 2017
1ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
2    NetworkInfo netInfo = cm.getActiveNetworkInfo();
3    //should check null because in airplane mode it will be null
4    NetworkCapabilities nc = cm.getNetworkCapabilities(cm.getActiveNetwork());
5    int downSpeed = nc.getLinkDownstreamBandwidthKbps();
6    int upSpeed = nc.getLinkUpstreamBandwidthKbps();
7