Android Get File Application Latest Upgrade Information
This method retrieves the latest upgrade strategy for file applications.
Request Parameter List
| Parameter Name | Type | Description |
|---|---|---|
| request | FileUpgradeRequest | Set specific interface request parameters, see File Application Get Upgrade Strategy |
Return Value List
| Return Value Name | Type | Description |
|---|---|---|
| result | FileUpgradeResponse | Interface return value, specific interface return parameters, see File 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 getFileUpgrade_shouldCallCallbackOnSuccess() throws Exception {
FileUpgradeRequest request = new FileUpgradeRequest(
"LOYlLXNy7wV3ySuh0XgtSg",
1,
0,
"",
""
);
try {
FileUpgradeResponse response = client.getFileUpgrade(request);
System.out.println("getFileUpgrade 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());
}
}
}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 getFileUpgradeAsync_shouldCallCallbackOnSuccess() throws Exception {
FileUpgradeRequest request = new FileUpgradeRequest(
"LOYlLXNy7wV3ySuh0XgtSg",
1,
0,
"",
""
);
CountDownLatch latch = new CountDownLatch(1);
Client.Callback<FileUpgradeResponse> callback = new Client.Callback<>() {
@Override
public void onSuccess(FileUpgradeResponse response) {
System.out.println("getFileUpgrade request response: " + response.toString());
latch.countDown();
}
@Override
public void onFailure(Throwable t) {
t.printStackTrace();
Assert.fail("getFileUpgrade request failed: " + t.getClass().getSimpleName() + ": " + t.getMessage());
latch.countDown();
}
};
client.getFileUpgradeAsync(request, callback);
Assert.assertTrue("Test timed out", latch.await(15, TimeUnit.SECONDS));
}
}