Search code examples
ibm-mobilefirstworklight-runtime

Is it possible to allow Worklight users to use app before updating?


Let's say I push new code to the Worklight server for purposes of a Direct Update. Can I allow users to still use the application for a set amount time before they actually have to accept the update or is the application essentially unavailable to them until they download the new code?


Solution

  • If you are developing your application using Worklight 6.2, then you as a developer can take over the entire Direct Update flow and can essentially decide how to handle a received update from the server.

    Note that by taking full control, you own the flow end-to-end; the default Worklight framework handling will not be available and the full responsibility is on the developer to ensure the validity of every step.

    You can read more about customizing Direct Update, here:

    In your scenario, I think you could probably go in a less extreme way and just do some tweaks before letting the Worklight framework handle the update from the server. Meaning, you could use the example provided in the training module (slide #18 from the PDF above), where you intercept the update:

    wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData, 
    directUpdateContext) { 
    
        ... // display message or counter
    }
    

    And display a message and start a counter, and when time's up just directUpdateContext.start(); the update.