Android Question StartServiceAt - bug in Time parameter?

JackKirk

Well-Known Member
Licensed User
Longtime User
As part of an exercise to manage out of memory problems I am exploring use of:
B4X:
    StartServiceAt("", DateTime.Now + 5000, False)
  
ExitApplication
in Starter.Application_Error

It seems to work OK except the Time parameter (DateTime.Now + 5000) does not delay restarting the app for 5 secs - restart occurs immediately.

Any ideas greatly appreciated...
 

JackKirk

Well-Known Member
Licensed User
Longtime User
Erel,

When I generate an out of memory error I find that I have to totally eradicate the failing app instance. If I don't then any attempt to resume use of the app results in the failing app instance being resurrected - with its memory still clogged and any attempt to resume use of it ends up with the same problem.

So when I trap an out of memory problem I want to totally kill the process and start a new instance.

Sounds like ExitApplication may be doing both and the StartService is unnecessary.
The OS treats it (ExitApplication) like a crash and may restart it.
I am a bit worried by the may in the above quote - maybe I should leave the StartService in to ensure the app is restarted?

Your comments are eagerly sought...
 
Last edited:
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
I did a bit more exploration, it appears that the StartService in post #1 is not necessary - but as it does not appear to do any harm I think I will leave it in as insurance for if/when ExitApplication does not cause app to restart.
 
Upvote 0
Top