Android SDK Quick Start
This document provides a quick start guide for performing common operations using the Android SDK. You will learn how to install the SDK, configure access credentials, and perform basic operations such as retrieving the latest upgrade information.
Notes
- To make requests using the Android SDK, you need to initialize a Client instance. This document creates a Client by loading default configurations. For more configuration options for the client, please refer to Configuring the Client.
Prerequisites
- Already registered an UpgradeLink account.
- Obtained AccessKey and AccessSecret.
- Configured URL application upgrade strategy.
Get Credentials

Install the SDK
- Add dependencies in a Gradle project (recommended method)
Add the maven repository address:
groovy
pluginManagement {
repositories {
maven { url 'https://jitpack.io' }
}
}To use the SDK in a Gradle project, simply add the corresponding dependency to build.gradle. Taking adding the dependency for version 2.3.0 in dependencies as an example:
groovy
implementation 'com.github.toolsetlink:upgradelink-api-android:2.3.0'Quick Usage
The following example program demonstrates how to initialize a Client and retrieve the latest upgrade information for a URL application.
Get URL Application Latest Upgrade Information - Synchronous Call
java
package com.toolsetlink.upgradelink.api;
import com.toolsetlink.upgradelink.api.models.*;
import org.junit.*;
import java.io.IOException;
import java.util.concurrent.*;
public class SimpleClientTest {
private Client client;
@Before
public void setUp() {
Config config = new Config();
config.accessKey = "mui2W50H1j-OC4xD6PgQag";
config.secretKey = "PEbdHFGC0uO_Pch7XWBQTMsFRxKPQAM2565eP8LJ3gc";
client = new Client(config);
}
@Test
public void getUrlUpgrade_shouldCallCallbackOnSuccess() throws Exception {
UrlUpgradeRequest request = new UrlUpgradeRequest(
"uJ47NPeT7qjLa1gL3sVHqw",
1,
0,
"",
""
);
try {
UrlUpgradeResponse response = client.getUrlUpgrade(request);
System.out.println("getUrlUpgrade request response: " + response.toString());
} catch (Exception e) {
// Print exception stack trace
e.printStackTrace();
// Let the test fail and give an error message
Assert.fail("getUrlUpgrade request failed: " + e.getClass().getSimpleName() + ": " + e.getMessage());
}
}
}Get URL Application Latest Upgrade Information - Asynchronous Call
java
package com.toolsetlink.upgradelink.api;
import com.toolsetlink.upgradelink.api.models.*;
import org.junit.*;
import java.io.IOException;
import java.util.concurrent.*;
public class SimpleClientTest {
private Client client;
@Before
public void setUp() {
Config config = new Config();
config.accessKey = "mui2W50H1j-OC4xD6PgQag";
config.secretKey = "PEbdHFGC0uO_Pch7XWBQTMsFRxKPQAM2565eP8LJ3gc";
client = new Client(config);
}
@Test
public void getUrlUpgradeAsync_shouldCallCallbackOnSuccess() throws Exception {
UrlUpgradeRequest request = new UrlUpgradeRequest(
"uJ47NPeT7qjLa1gL3sVHqw",
1,
0,
"",
""
);
CountDownLatch latch = new CountDownLatch(1);
Client.Callback<UrlUpgradeResponse> callback = new Client.Callback<>() {
@Override
public void onSuccess(UrlUpgradeResponse response) {
System.out.println("getUrlUpgrade request response: " + response.toString());
latch.countDown();
}
@Override
public void onFailure(Throwable t) {
t.printStackTrace();
Assert.fail("getUrlUpgrade request failed: " + t.getClass().getSimpleName() + ": " + t.getMessage());
latch.countDown();
}
};
client.getUrlUpgradeAsync(request, callback);
Assert.assertTrue("Test timed out", latch.await(15, TimeUnit.SECONDS));
}
}