WL 5.0.6.1 Android - Direct Update keeps Native/Cordova resources active/in memory (e.g. BusyIndicator) but reference is lost

£可爱£侵袭症+ 提交于 2019-11-28 08:52:08

问题


We are having a problem when we have the following sequence:

  • App Startup
  • Web Resources start
  • Show a Busy Indicator (1)
  • Connect to WL Server
  • Direct Update gets triggered
  • Web Resources restart
  • Show a Busy Indicator (2)
  • Connect to WL Server
  • Success
  • Load and change to welcome page
  • Hide Busy Indicator (2)

This has the effect that in the direct-updated web resources we are (of course) loosing/missing the reference to the busy indicator (1) and we are not able to hide that indicator after the direct update was triggered. So then, we have two indicators (1) (2) open and only one (2) is closed, the old one (1) is up forever.

One solution would be to get an event before the direct update is triggered/executed ... there we could hide our indicator (1). This would then become quite similar to this question: IBM Worklight - How can I execute JavaScript code before updating the application?

A more general approach would be to trigger a "deeper" restart of the app ... meaning to also restart the native shell and all cordova resources. Then all native resources like busy indicator and other things should be removed and reset, right?

Is there any way to achieve such a "deep" restart of the app after direct update? Is this problem known?

UPDATE Sept. 5

We saw that the following events are fired sometime before the DirectUpdate restarts the web resources:

window.addEventListener("beforeunload",
    function() { 
       WL.Logger.debug("busy test - unload2"); 
        app.busytest.hide();
            }
        , false);

window.addEventListener("unload",
    function() { 
       WL.Logger.debug("busy test - unload3"); 
         app.busytest.hide();
            }
        , false);

... but unfortunately hiding our WL.BusyIndicator "busytest" does not work in these events anymore. Does anyone have any ideas?

But maybe some other cleanup code could be placed there in case of a DirectUpdate?


回答1:


Busy indicator is a singleton. If you create several busy indicators, show them and then hide of them - all will be hidden.



来源:https://stackoverflow.com/questions/18623000/wl-5-0-6-1-android-direct-update-keeps-native-cordova-resources-active-in-memo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!