Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #internet #speed #android #programmatically
ADD COMMENT
Topic
Name
8+3 =