Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo SDK Support › Keep app alive – Prevent closing on background

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25562

    Alberto

    Hi Felgo Team!

    My app has a payment feature that needs confirmation on the user bank app.

    I noticed that depending on the device, when switching to the bank app, my app closes, maybe related to automatic memory management (Android).

     

    I tried to monkey-copy some code from ChatGPT in order to avoid this behaviour, trying to set some kind of priority to my app, letting the system know that I am in an important operation, and should keep my app alive as far as possible.

     

    I had no success, so my question is, is this even possible at all, and in that case, should you provide some hints?

    Thank you!

    #25563

    Günther
    Felgo Team

    Hi Alberto,

    I checked back with the team and from what I get it cannot be guaranteed that the backgrounded application will be closed by the OS. The system can close activities that are in background at any time if it needs the resources. Some users may also use task manager apps that forcefully close backgrounded apps to “save” RAM. Also, there’s an option in the developer settings to always close apps.

    This means that the application can never 100% avoid being shut down, and the best way to handle it is to provide functionality to manually restore the previous state upon next app startup. There are some native Android APIs for activites that allow for state handling:
    https://developer.android.com/topic/libraries/architecture/saving-states
    2:06
    https://developer.android.com/reference/android/app/Activity#onSaveInstanceState(android.os.Bundle)

    But as the Qt app all runs in a single Qt activity, it might be best to memorize and restore the previous state using some custom app settings/storage in your QML/JS code. Unfortunately there’s no easy guaranteed way to always keep the alive.

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded