I am developing an android video-streaming application where I must detect internet speed to adjust my stream quality according to that speed.
I've searched in the net about how to detect internet speed in android but I found only one method of downloading file and knowing its size to determine the bandwidth :
bandwidth = contentLength / ((endTime-startTime) *1000);
Is there any other possible way to determine internet bandwith in android without downloading any file I don't want to disturb my video streaming by additional file downloading
Thanks.
If you are on 2G,3G,4G, I don't think there is a standard way of finding out, maybe you can assume automatically that 2G,3G or 4G is slow.
If you are using wifi then you can calculate internet speed using WifiManager class
and then from the WifiInfo you can get the current speed :