Myket KB for Developers

Check Version Update service

Checking Update service By Checking Update Service, you can check the latest compatible version of user’s device. You can also get VersionCode and display the latest version changes for your users, if necessary, you can use Myket intents for direct Updating. Add auxiliary files to the project Download the auxiliary files here. Then open the zip file. This file contains a folder named util and an AIDL file. Just add it to the project according to the picture: In projects created with Android Studio, you need to copy AIDL files to the java / helpl directory. But in old structures like projects created with Eclipse, copy AIDL files to their own address (the package included in the file) along other Java files. Now rebuild the project and note that if you use the Gradle tool, you should do Gradle synchronization to compile AIDL files. How to use you must first create a Sample of the MyketHelper class and then set it up:

mMyketHelper = new MyketSupportHelper(this);
mMyketHelper.startSetup(new MyketSupportHelper.OnMyketSetupFinishedListener() {
   @Override
   public void onMyketSetupFinished(MyketResult result) {
      if (!result.isSuccess()) {
         alert(getString(R.string.problem_error_api_connect));
         return;
      }
   }
});

Call the getAppUpdateStateAsync method and get callback to calling your checking update service:

mMyketHelper.getAppUpdateStateAsync(mCheckAppUpdateListener);
 
private MyketSupportHelper.CheckAppUpdateListener mCheckAppUpdateListener = new MyketSupportHelper
        .CheckAppUpdateListener() {
    @Override
    public void onCheckAppUpdateFinished(MyketResult result, Update update) {
        showLoading(false);
        if (!result.isSuccess()) {
            alert(getString(R.string.problem_in_myket_service));
            return;
        }
        if (update.isUpdateAvailable()) {
            updateAlert(update.getDescription());
        } else {
            alert(getString(R.string.you_already_have_the_lastest_version));
        }
    }
};

OnCheckAppUpdateFinished returns a class called Update that contains the following fields: isUpdateAvailable: If your application is updated on Myket, this field is True and otherwise False. description: New features of the latest compatible version of device versionCode: The latest compatible version of device Note that for testing these scenarios, your app must be visible for Myket admins and approved by them. Sample app you can Download the sample app here.