Answers for "how to get internet speed in android programmatically"

0

how to get internet speed in android programmatically

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();
Posted by: Guest on August-23-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language