Flutter - How to prevent an app from being closed by the mobile OS?

Viewed 834

I'm new to mobile development and I'm starting with Flutter to build a cross-platform app with a login process for Android and iOS. One of the app requirements is to keep the app session active and running permanently unless the user signs out or closes the app.

The API for the backend has a refresh token to keep the session open/alive, but the mobile OS keeps closing the app every few hours/days and restarting the login process.

How can I achieve this?

1 Answers

You cannot prevent the app from restarting.

However, you can implement some way of persisting the login between sessions such that even when the app gets stopped the user is still logged in when the app opens again.

Related