1
votes

I want to know what is exactly the behaviour of wlCommonInit() function.

I have moved my initialization code into this function, but then it seems to be not called in the case of connection to the server failure.

  • is wlCommonInit() called when the Worklight server is not reachable ?
  • If I want to use direct update, I want to call WL.Client.updateUserInfo() on my initialization, and I want the app to be working also in offline mode, does this mean I must implement onConnectionFailure in wlInitOptions ?
  • If I implement onConnectionFailure in wlInitOptions, can I display the default popup that inform about the connection failure, and provide details ?
1

1 Answers

0
votes

It really depends on the logic you wrote in your "initialization code" IMO. The question is somewhat cryptic...

  1. The wlCommonInit function is called once the Worklight framework has completed initialization. If you set connectOnStartup to true, only if connection to the server is successful, it will then be called.

  2. Direct Update is not related to any specific API you implement in your application. If you change any web resource in your project (HTML, CSS, JavaScript, images, ...), this will trigger a Direct Update in the application.

    A Direct Update is checked in 2 scenarios:

    • on application launch, and
    • on return to the foreground (if the app was in the background)


    The Direct Update check is performed only if and when the application connects to the Worklight Server. If you did not previously set your application by either using connectOnStartup:true or used WL.Client.connect or invoked an adapter procedure (all three send a request to the server), the Direct Update check will not be done.

  3. If you choose to override the default dialog provided by Worklight by using onConnectionFailure, the Details button (which I assume if what you wanted) - is not available. By overriding, you select to fully customize it.