Detect network connection bandwidth (Android)
I need to determin开发者_开发知识库e programmatically the bandwith of the network connection (not the same as network type (WIFI/3G)). How can i do this? Timing a (short) download?
thanks
Step #1: Download something big.
Step #2: Divide the size of the "something big" by the time it took to download to get your bandwidth.
that's for the download and for the upload I used a socket (TCP) and I tried to write an array of bytes in its outputstream so fast as I can and in the end I flush the buffer and devided the number of bytes by the time elapsed to write the whole array in the outputstream.
another alternativ is to try to upload a something big and then devide the "something big" by the time took to upload.
精彩评论