Download Test

Adding To build.sbt

sbt
libraryDependencies += "com.quadstingray" %% "speedtest" % "0.8.2"
Maven
<dependencies>
  <dependency>
    <groupId>com.quadstingray</groupId>
    <artifactId>speedtest_2.13</artifactId>
    <version>0.8.2</version>
  </dependency>
</dependencies>
Gradle
dependencies {
  implementation "com.quadstingray:speedtest_2.13:0.8.2"
}

Run Download Test

The Framework choose the automatic method to find best server.

sourceval speedTestResult = SpeedTest.runDownload()

Run Download Test with specific Server

Removed from API because Token needed

Run Download Test with CallBacks

With CallBacks you can update your UI do somethings at running the test.

sourcevar dlCount        = 0
var dlBandwidthSum = 0.0
def dlCallBack(result: MeasurementResult): Unit = {
  dlCount += 1
  dlBandwidthSum += result.bandwidth.bytePerSeconds
}

val speedTestResult = SpeedTest.runDownload(downloadMeasurementCallBack = dlCallBack)