API documentation - speedchecker/speedchecker-sdk-android GitHub Wiki

Supported test types, classes, events and callbacks.

Speed test

SpeedcheckerSDK

This function initializes SDK:

void init(Context context)

Init SDK with licenseKey

void init(Context context, String licenseKey)

This function asks for required permissions:

void askPermissions(Activity activity)


SpeedcheckerSDK.SpeedTest

These functions start a new speed test from your code:

void startTest(Context context)

void startTest(Context context, SpeedTestOptions options)

void startTest(Context context, Server server)

void startTest(Context context, Server server, SpeedTestOptions options)

void startTest(Context context, String downloadURL, String uploadURL)

void startTest(Context context, String downloadURL, String uploadURL, SpeedTestOptions options)

This function sets callbacks that you can use to change Views:

void setOnSpeedTestListener(SpeedTestListener listener)

Use this function to get the Server before the test:

void getBestServer(Context context, SpeedTestListener.GetBestServer listener)

This function finishes the current speed test from your code:

void interruptTest()


SpeedTestResult

This function Returns a Speed test date:

Date getDate()

This function returns the value of download speed in Mb/s:

Float getDownloadSpeed()

This function returns the value of upload speed in Mb/s:

Float getUploadSpeed()

This returns the value of ping time in milliseconds:

public Integer getPing()

This function returns the value of transferred download data in Megabytes:

public double getDownloadTransferredMb()

This function returns the value of transferred upload data in Megabytes:

public double getUploadTransferredMb()

This function returns cross-traffic speed in Mb/s (for a Wifi connection only):

public Float getDownloadCrossTrafficSpeed()

public Float getUploadCrossTrafficSpeed()

This function returns cross-traffic transferred Mb (for a Wifi connection only):

public Float getDownloadCrossTrafficTransferredMb()

public Float getUploadCrossTrafficTransferredMb()

This function returns the Server object. Please, go to Server classes to get more information:

Server getServer()

Packet loss in %:

Double getPacketLoss()

Active data provider name:

String UserISP

Active data IP address:

String UserIP

Also, you may find a few helpers for your scenario. Something like isValid() or hasDownloadSpeed()


SpeedTestOptions

Set Speed test customization parameters. Not available in free version.

public void setSendResultsToSpeedChecker(boolean value) Enable/disable sending speed test result to server.

public void setSpeedTestType(int value) Set speed test type. 0 - default http protocol, 1 - wss sockets protocol, 2 - server send events protocol.

public void setDownloadTimeMs(int value) Set download speed test duration in milliseconds.

public void setUploadTimeMs(int value) Set upload speed test duration in milliseconds.

public void setDownloadThreadsCount(int value) Set download threads count.

public void setUploadThreadsCount(int value) Set upload threads count.

public void setConnectionTimeoutMs(int value) Set connection timeout time in milliseconds, before exit test with error.

public void setSpeedLimitForAdditionalThreadsMbps(int value) Set speed threshold value in mb/s for increasing threads count. extra_threads_count = current_speed/threshold_values

public void setAdditionalThreadsCount(int value) Set max additional threads count when speed exceeds threshold value.

public void setSlidingWindow(int downloadValidSlidingWindowTimeMs, int uploadValidSlidingWindowTimeMs) Set speed sampling interval in milliseconds for download and upload measurements.


Server

This object has public fields.

This object returns the value of the Server domain name:

String Domain

This object returns the Location object of the Server location:

Location Location


Location

This object has public fields.

This returns country and city:

String CountryCode

String Country

String City


WiFi network test

SpeedcheckerSDK.WifiSpeedTest

This function starts a new wifi speed test from your code:

void startTest(Context context)

This function starts a new wifi speed test from your code using the test time parameter:

void startTest(Context context, int testTimeSeconds)

This function starts a new wifi speed test from your code using the max transfer data limit in Mb:

void startTest(Context context, double maxTransferDataMb)

This function starts a new wifi network speed test from your code using the test time parameter and max transfer data limit in Mb (Only speed to your wifi router is measured in this case):

void startTest(Context context, int testTimeSeconds, double maxTransferDataMb)

This function sets callbacks that you can use to change Views:

void setOnWifiSpeedTestListener(WifiSpeedTestListener listener)

This function finishes the current wifi network speed test from your code:

void interruptTest()


WifiSpeedTestResult

Returns the current frequency in MHz:

int getFrequency()

Returns the received signal strength indicator of the current 802.11 networks, in dBm:

int getSignalStrength()

Returns the value of throughput in Mb/s:

double getSpeed()

Returns the value of ping time in ms:

int getRouterLatency()

Returns the current link speed (max theoretical throughput) in Mb/s.

double getLinkSpeed()

Returns the transferred data in Mb:

double getTransferredMb()


WifiSpeedTestError

List of errors returned by wifi network speed test:

public static DEVICE_NOT_SUPPORTED

public static EMPTY_RESULT

public static NO_CONNECTION

public static USER_STOPPED_TEST

public static EXCEPTION


YouTube test

YouTubeTestListener

An interface for communication during YouTube test:

interface YouTubeTestListener


Callbacks

Callback that returns measurement results from YouTube test. All data is collected in YouTubeTestResult object:

onResult(YouTubeTestResult result)

Returns an error message. Not for UI usage. Mostly for dev and debugging:

onError(String msg)


YouTubeTestResult

Contains measurement results associated with YouTube test.

Time delay (in milliseconds) before video started playing:

long getStartTime()

A counter represents how many times BUFFERING events took place during video play:

int getRebufferRate()

Download internet speed during the video play (in Mb/s):

float getSpeed()

Represents last playback resolution (e.g. hd1080 or hd2160):

String getLastBitrate()

List delivered serving cell information and associated measurements:

List<SCellInfo> getCellInfoList()

List delivered serving cell information and associated measurements:


VoIP test

Voice over IP call test. Aims to measure VoIP call performance.

VoIPTest.startTest

To start VoIP test use:

SpeedcheckerSDK.VoIPTest.startTest( this, callDuration, callCount, rtpTimeout, payloadType, callback );


IVoIPTestListener

An interface for communication during VoIP test:

interface IVoIPTestListener

To implement VoIP test interface use:

IVoIPTestListener callback = new IVoIPTestListener() {
            @Override
            public void onResult(VoIPCallTaskResult result) {//handle result}

            @Override
            public void onProgress(int progress) {//show progress}

            @Override
            public void onFatalError(String message) {//handle error}
        };

Callbacks

Callback that returns measurement results from VoIP test. All data is collected in VoIPCallTaskResult object.

onResult(VoIPCallTaskResult result)

Returns an error message. Not for UI usage. Mostly for dev and debugging:

onError(String msg)

Returns current test progress:

onProgress(int progress)


VoIPCallTaskResult

List of call results:

List<VoIPCallResult> callResultList

Count of successfully completed calls:

int callCompletionSuccessCount

Count of successfully established calls:

int callSetupSuccessCount

Count of call setup attempts:

int taskCallAttemptCount

Returns average calls setup time in milliseconds:

Long getAverageCallSetupTime()


VoIPCallResult

Call result state(OK, ERROR, TIMEOUT)

VoIPCallResultState resultState

Download result:

RtpResult downloadRtpResult

Upload result:

RtpResult downloadRtpResult

Call setup time in milliseconds:

Long callSetupTime


RtpResult

Mean Jitter:

float meanJitter

Average Stall time:

long avgStallTime

Mean Opinion Score:

float MOS


Secondary cell information

SCellInfo

Сontains cellular info associated with either Speed Test or YouTube Test.

Returns Cell id:

long getCellId()

Returns Location Area Code:

int getLAC()

Returns Tracking Area Code:

int getTAC()

Returns Mobile Country Code:

int getMCC()

Returns Mobile Network Code:

int getMNC()

Returns Absolute Radio Frequency Channel Number:

int getChannelNumber()

Returns Radio Access Type (e.g. WIFI, 5G, 4G, 3G, 2G):

String getType()

Returns a flag that represents if info about the cell comes from SIM that is used for DATA:

boolean isFromDataSim()

Returns a flag that represents if info about the cell comes from SIM that is used for CALLS:

boolean isFromCallSim()

Returns LTE Reference Signal Received Power in dBm:

int getLteRSRP()

Returns LTE Reference Signal Received Quality in dB:

int getLteRSRQ()

Returns LTE Reference Signal Signal-to-Noise Ratio in dB:

int getLteRSSNR()

Returns LTE Channel Quality Indicator:

int getLteCQI()

Returns 5G NR SS Reference Signal Received Power in dBm:

int getNrRSRP()

Returns 5G NR SS Reference Signal Received Quality in dB:

int getNrRSRQ()

Returns 5G NR SS Signal-to-Noise and Interference Ratio in dB:

int getNrSINR()

Returns GSM Received Signal Level (RxLev in dBm):

int getGsmRSSI()

Returns 3G WCDMA CPICH RSCP in dBm:

int getWcdmaRSCP()


Reported connection issues

ConnectionIssue

public static String CALL_DROP = &quot;CallDrop&quot;;

public static String POOR_CALL_QUALITY = &quot;PoorCallQuality&quot;;

public static String NO_SIGNAL = &quot;NoSignal&quot;;

public static String UNABLE_TO_MAKE_A_CALL = &quot;UnableToMakeACall&quot;;

public static String NO_MOBILE_INTERNET = &quot;NoMobileInternet&quot;;

public static String SLOW_INTERNET_SPEED = &quot;SlowInternetSpeed&quot;;


Events

Speed test

void onFetchServerFailed()

This occurs when you have no active server defined in the SDK, or none of them are currently responding over the Internet.

void onTestStarted()

This occurs when the speed test process started.

void onTestFinished(SpeedTestResult result)

This occurs when the speed test is finished successfully.

void onPingStarted()

This occurs when the speed test started to measure user's latency (ping).

void onPingFinished(int ping, int jitter)

This occurs when the speed test finishes measuring user's latency (ping) and jitter.

void onDownloadTestStarted()

This occurs when the speed test starts to measure user's download speed.

void onDownloadTestProgress(int progress, double speedMbs, double transferredMb)

This occurs during the download speed testing process.

void onDownloadTestFinished(double speedMbs)

This occurs when the speed test finishes measuring user's download speed.

void onUploadTestStarted()

This occurs when the speed test starts to measure user's download speed.

void onUploadTestProgress(int progress, double speedMbs, double transferredMb)

This occurs during the upload speed testing process.

void onUploadTestFinished(double speedMbs);

This occurs when the speed test finished measuring user's upload speed

void onFindingBestServerStarted()

This occurs when the SDK tries to find the best server

void onTestFatalError(String errorMessage)

This occurs when the speed test stopped because of some fatal error

void onTestInterrupted(String message)

This occurs when the speed test is interrupted by the user


Wifi speed test

void onTestStarted();

This occurs when the wifi speed test process started.

void onPingStarted()

This occurs when the wifi speed test started to measure user's router latency (ping).

void onPingFinished(int timeMs)

This occurs when the wifi speed test is finished measuring user's router latency (ping).

void onTestFinished(WifiSpeedTestResult result)

This occurs when the wifi speed test is finished successfully.

void onTestProgress(int progress, double speedMbs, double transferredMb)

This occurs during the wifi speed testing process.

void onTestFatalError(WifiSpeedTestError error)

This occurs when the wifi speed test stopped because of some fatal error.

void onTestInterrupted(WifiSpeedTestError error)

This occurs when the wifi speed test is interrupted by the user.

⚠️ **GitHub.com Fallback** ⚠️