Prevent components from destroying or stopping their functions

Ewpatton has given a solution to listen for event dispatches of the components created dynamically. Most of the components destroy or stop their function (for example a clock's timer stopping itself when an app is killed and a player stopping the music when the app is killed). So is it possible to prevent them from destroying somehow? This looks difficult to do but most of the components behave like this so if we use events in the background, then the component object must be active else it stops.

Is it possible to do the same thing in the Background process?


Since you are using your extension's component container (which is on main thread and in foreground) so it is obvious for components to destroy themselves when app is killed/stopped.

How will it behave if its not the extension's container?

You should try first.

I have alredy tried before creating a new component container which dosent work as you know. I need to try the way Ewpatton did to create the component. I dont think it will behave different from this one.

This isn't really feasible because of how the class hierarchy works. AndroidNonvisibleComponent instances always take the Form as a parent. The nonvisible components need to be refactored so that they can take something other than a Form so that the components could be owned by a different Context. This was the crux of the work that went into the services functionality, but it's not part of the mainline App Inventor distro.