sync
Checks with live updates to see if any new builds are available. If they are, attempt to download, unzip, and update the saved data to reference the latest build.
Example usage (kotlin):
LiveUpdateManager.sync(context)
// Sync with a callback
LiveUpdateManager.sync(context, callback = object : SyncCallback {
override fun onAppComplete(syncResult: SyncResult) {
Log.d("LiveUpdate","CALLBACK: Sync success for app ${syncResult.liveUpdate.appId}!")
}
override fun onAppComplete(failResult: FailResult) {
Log.e("LiveUpdate","CALLBACK: Sync failed at step ${failResult.failStep.name} for app ${failResult.liveUpdate.appId}!")
}
override fun onSyncComplete() {
Log.d("LiveUpdate","CALLBACK: Sync finished!")
}
})
Example usage (Java):
Long lastSync = LiveUpdateManager.getLastSync(context);
// Sync with a callback
LiveUpdateManager.sync(this, new SyncCallback() {
@Override
public void onAppComplete(@NonNull SyncResult syncResult) {
Log.d("LiveUpdate","CALLBACK: Sync success for app " + syncResult.getLiveUpdate().getAppId());
}
@Override
public void onAppComplete(@NonNull FailResult failResult) {
Log.d("LiveUpdate","CALLBACK: Sync failed at step " + failResult.getFailStep().name() + " for app " + failResult.getLiveUpdate().getAppId());
}
@Override
public void onSyncComplete() {
Log.d("LiveUpdate","CALLBACK: Sync finished!");
}
});
Parameters
an Android Context used during the app update operation
a SyncCallback to notify on each app sync complete and when sync is complete
Checks a single app with live updates to see if any new builds are available. If they are, attempt to download, unzip, and update the saved data to reference the latest build.
Example usage (kotlin):
LiveUpdateManager.sync(context, "appId")
// Sync with a callback
LiveUpdateManager.sync(context, "appId", callback = object : SyncCallback {
override fun onAppComplete(syncResult: SyncResult) {
Log.d("LiveUpdate","CALLBACK: Sync success for app ${syncResult.liveUpdate.appId}!")
}
override fun onAppComplete(failResult: FailResult) {
Log.e("LiveUpdate","CALLBACK: Sync failed at step ${failResult.failStep.name} for app ${failResult.liveUpdate.appId}!")
}
override fun onSyncComplete() {
Log.d("LiveUpdate","CALLBACK: Sync finished!")
}
})
Example usage (Java):
Long lastSync = LiveUpdateManager.getLastSync(context, "appId");
// Sync with a callback
LiveUpdateManager.sync(this, "appId", new SyncCallback() {
@Override
public void onAppComplete(@NonNull SyncResult syncResult) {
Log.d("LiveUpdate","CALLBACK: Sync success for app " + syncResult.getLiveUpdate().getAppId());
}
@Override
public void onAppComplete(@NonNull FailResult failResult) {
Log.d("LiveUpdate","CALLBACK: Sync failed at step " + failResult.getFailStep().name() + " for app " + failResult.getLiveUpdate().getAppId());
}
@Override
public void onSyncComplete() {
Log.d("LiveUpdate","CALLBACK: Sync finished!");
}
});
Parameters
an Android Context used during the app update operation
a registered appId to sync
a SyncCallback to notify on each app sync complete and when sync is complete
Checks all apps or a provided set of apps with live updates to see if any new builds are available. If they are, attempt to download, unzip, and update the saved data to reference the latest build.
Example usage (kotlin):
LiveUpdateManager.sync(context, arrayOf("appId1", "appId2"))
// Sync with a callback
LiveUpdateManager.sync(context, arrayOf("appId1", "appId2"), async = false, callback = object : SyncCallback {
override fun onAppComplete(syncResult: SyncResult) {
Log.d("LiveUpdate","CALLBACK: Sync success for app ${syncResult.liveUpdate.appId}!")
}
override fun onAppComplete(failResult: FailResult) {
Log.e("LiveUpdate","CALLBACK: Sync failed at step ${failResult.failStep.name} for app ${failResult.liveUpdate.appId}!")
}
override fun onSyncComplete() {
Log.d("LiveUpdate","CALLBACK: Sync finished!")
}
})
Example usage (Java):
Long lastSync = LiveUpdateManager.getLastSync(context, new String[] {"appId1", "appId2"});
// Sync with a callback
LiveUpdateManager.sync(this, new String[] {"appId1", "appId2"}, false, new SyncCallback() {
@Override
public void onAppComplete(@NonNull SyncResult syncResult) {
Log.d("LiveUpdate","CALLBACK: Sync success for app " + syncResult.getLiveUpdate().getAppId());
}
@Override
public void onAppComplete(@NonNull FailResult failResult) {
Log.d("LiveUpdate","CALLBACK: Sync failed at step " + failResult.getFailStep().name() + " for app " + failResult.getLiveUpdate().getAppId());
}
@Override
public void onSyncComplete() {
Log.d("LiveUpdate","CALLBACK: Sync finished!");
}
});
Parameters
an Android Context used during the app update operation
an array of registered appId's to sync, default of empty array will sync all apps
whether to run updates in parallel or not (true by default)
a SyncCallback to notify on each app sync complete and when sync is complete