Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
562 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...