Android Question Problem with app resume

tseyfarth

Member
Licensed User
Longtime User
Hello all,

Please forgive me if I use the wrong terminology - I'm having a problem figuring out how to resume an app that has been pushed to the background.

My app uses B4XPages and a Service to take care of connections, sending and receiving data via BLE. This works fine, even after the app is resumed (although I have no code for that).

Can anyone tell me the proper procedure and code example for resumption of an app? What are the subs that should be used for resume and to prepare the app to go to the background?

What I have seen, is when a user presses a button on screen to exit the app, this code is executed:
B4X:
        Dim jo As JavaObject
        jo.InitializeContext
        jo.RunMethod("finishAndRemoveTask", Null)
        B4XPages.ClosePage("main_page")

That takes the app to the background where it continues to run.
Question - when is it actually killed? Do I need to stop the Service(s)?

When the user presses the icon, the app returns to the foreground. The BLE is still running and working, most of the views are present and working, however there is one label that is either hidden or non-existing anymore. How do I correct this?

Thank you,
Tim
 

tseyfarth

Member
Licensed User
Longtime User
Hello Erel,

I am confused, in a previous post

Best practice for BLE when you need it to run even when the app is not visible? The post was 146623/#post-929746​

you wrote:

Now that I have that all done, and working, which *is* the best practice?

Thank you for your help!
Tim
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…