I’ve migrated an app from Ionic v4 to v6. It has various Capacitor and Cordova dependencies, and uses Angular 14 now. All seems to be well except for one issue. The basic flow is user logs in/auths with JWT to a server and stores a token. Then app goes to it’s main page. User does their thing and maybe leaves the app for a couple days. Prior to migration, when I would open the app back up, it would go back to the login page in which case would validate the token and proceed. That all used to work as expected. However, now the app just stays at whatever page it was on when the user left the app (sitting in the background for a day let’s say). Everything is fine if it’s just a couple hours but leave it for a day and the data is gone. At that point all of the local data has disappeared and the constructor for that particular page seems to be called again. The page has no data cached and shows more or less blank (because all the data is in storage, grabbed from services, or passed into the page under normal circumstances).
Example: I leave the app on PageC and open it the next day. It needs the data passed from PageB (think detailed view of PageB) to display but it’s not there. What should happen is a full reload back to Login.
/Login → /MainPage → /PageB → /PageC
What causes an Ionic app to restart versus maintain some sort of state in the background? I could post code but don’t know what to, before any commentary. The routing is very basic all preloaded. Is there something new in Angular that’s missing?
Similar but the reverse I suppose. I want the app to “die out” after a while so the app can go through its automatic auth steps. Otherwise there’s a chance the user is going to try and push data with an invalid token, which I have hooks for but would rather avoid in the normal flow.
I just looked quick and I interestingly enough show android:launchMode=“singleTask” on this app. That said, I haven’t even gotten to testing this leave it a long time issue on Android, this appears on iOS for sure though.
Are you seeing your issue on all devices right now? With the current issue I have, I only seem to be seeing it in one of my test devices - an iPhone SE. On my iPhone 11 I’m not seeing it. Admittedly our issues may be different even though they are similar