Can I use Software Update API to update application itself? This is the code I’m trying to use for testing purposes:
try {
Path updPath = Paths.get(“/home/appfx30/fx30.upd”);
File pack = new File(updPath.toUri());
logger.log(Level.INFO, “Opening…”);
FileInputStream fis = new FileInputStream(pack);
update.AddProgressHandler(new Update.ProgressHandler() {
@Override
public void handle(Update.State updateState, int percentDone) {
switch (updateState) {
case STATE_APPLYING:
logger.log(Level.INFO, “Applying…” + percentDone);
break;
case STATE_FAILED:
logger.log(Level.INFO, “Failed…” + percentDone);
break;
case STATE_SUCCESS:
logger.log(Level.INFO, “Success…” + percentDone);
break;
case STATE_UNPACKING:
logger.log(Level.INFO, “Unpacking…” + percentDone);
break;
}
}
});
logger.log(Level.INFO, “Starting…”);
update.Start(fis.getFD());
logger.log(Level.INFO, "Started: " + update.GetErrorCode());
} catch (IOException e) {
logger.log(Level.INFO, "Error: " + e, e);
}
It hangs on update.Start().
# sdir list ... WAITING CLIENTS [pid 7671] fx30.Update UNBOUND (protocol ID = 'aa0702b2ee62b2e6b86f1b71708b329e')
Part of cdef:
requires: { api: { Update = le_update.api } }
Part of adef:
bindings: { fx30.App.Update -> .le_update }
So two questions:
- why it is unbound?
- is it even possible to self-update?
Thanks.