I had some troubles when an app went into the background, and I press the app icon to get it up again. Min was being destroyed and recreated, and odd behaviour ensued. I fixed it with a suggestion from Avansy, by ending main on entry if FirstTime is false:
Then I found I could not start my app once I had killed it completely in the task manager, FirstTime was still true when starting the app. I guess maybe my service module was still running beccause I don't stop it. So, I modified my app closing by adding an ExitApplication, like this:
Seems to work well now, but I just wanted to ask if my strategy seemed sound, because I recalll hearing that ExitApplication should not be used if possible. Thanks.
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime = False Then
Activity.Finish
Else
do something....
End If
End Sub
Then I found I could not start my app once I had killed it completely in the task manager, FirstTime was still true when starting the app. I guess maybe my service module was still running beccause I don't stop it. So, I modified my app closing by adding an ExitApplication, like this:
B4X:
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed = True Then
CallSub2(Unit_Comms, "KillUnit", "Main")
Awake.ReleaseKeepAlive
ExitApplication
End If
End Sub
Seems to work well now, but I just wanted to ask if my strategy seemed sound, because I recalll hearing that ExitApplication should not be used if possible. Thanks.