bertrandmartel / speed-test-lib

:cloud: JSpeedTest : speed test client library for Java/Android
MIT License
381 stars 119 forks source link

It's possible to get the float Mb\s? #25

Closed ThallyssonKlein closed 7 years ago

ThallyssonKlein commented 7 years ago

Hi there. I'm testing this library, and I think it amazing. But I would like to get the float Mb\s of the speed test. Somebody know to tell me if it's possible?

bertrandmartel commented 7 years ago

You can get SpeedTestReport from different callback

SpeedTestReport object has all information about the test at the moment the callback was triggered. Bitrate is given in BigDecimal type for better precision, you can convert it easily to any other type including float :

float bps = report.getTransferRateBit().floatValue();
double bps = report.getTransferRateBit().doubleValue();
int bps = report.getTransferRateBit().intValue();
ThallyssonKlein commented 7 years ago

It works perfectly. Thank you for help me.