Skip to content

Android Get Android Application Latest Upgrade Information ​

This method retrieves the latest upgrade strategy for Android applications.

Request Parameter List ​

Parameter NameTypeDescription
requestApkUpgradeRequestSet specific interface request parameters, see Android Application Get Upgrade Strategy

Return Value List ​

Return Value NameTypeDescription
resultApkUpgradeResponseInterface return value, specific interface return parameters, see Android Application Get Upgrade Strategy

Example Code ​

You can use the following code to obtain the latest upgrade strategy - 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 getApkUpgrade_shouldCallCallbackOnSuccess() throws Exception {
        ApkUpgradeRequest request = new ApkUpgradeRequest(
                "isVZBUvkFhv6oHxk_X-D0Q",
                1,
                0,
                "",
                "",
                0
        );

        try {
            ApkUpgradeResponse response = client.ApkUpgrade(request);
            System.out.println("getApkUpgrade request response: " + response.toString());
        } catch (Exception e) {
            // Print exception stack trace
            e.printStackTrace();
            // Let the test fail and give an error message
            Assert.fail("getApkUpgrade request failed: " + e.getClass().getSimpleName() + ": " + e.getMessage());
        }
    }

}

You can use the following code to obtain the latest upgrade strategy - 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 apkUpgradeAsync_shouldCallCallbackOnSuccess() throws Exception {
        ApkUpgradeRequest request = new ApkUpgradeRequest(
                "isVZBUvkFhv6oHxk_X-D0Q",
                1,
                0,
                "",
                "",
                0
        );
        CountDownLatch latch = new CountDownLatch(1);

        Client.Callback<ApkUpgradeResponse> callback = new Client.Callback<>() {
            @Override
            public void onSuccess(ApkUpgradeResponse response) {
                System.out.println("getApkUpgrade request response: " + response.toString());
                latch.countDown();
            }

            @Override
            public void onFailure(Throwable t) {
                t.printStackTrace();
                Assert.fail("getApkUpgrade request failed: " + t.getClass().getSimpleName() + ": " + t.getMessage());
                latch.countDown();
            }
        };

        client.ApkUpgradeAsync(request, callback);
        Assert.assertTrue("Test timed out", latch.await(15, TimeUnit.SECONDS));
    }
}

toolsetlink@163.com