Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter app UI is frozen after reactivated from background on IOS

I have an application developed in Flutter, and I have some problem with it on IOS when activating from background.

It is enabled to use location background mode on IOS. It works in background without any problem, even for days, it does what it has to do. But when I open the app after a longer time period (about one day or more) working in background, the UI is frozen! Note, if I do it after some hours, it is okkey, the problem comes after a longer period.

Flutter version: [✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.5 19F101, locale hu-HU)

What can I do to fix it? Should I re-init UI somehow in Flutter? Or do anything from native side?

Thanks a lot, any help is highly appriciated!

like image 319
Tom Avatar asked Aug 14 '20 12:08

Tom


Video Answer


1 Answers

Make sure that the state of your app is cached some way after entering background. It might not be in memory any more after a longer period of time and your UI is unable to render without it.

The issue does not seem to be related to background location fetching - try isolating that problem by running your app on a real device with debug enabled. Switch it to background and open some memory hungry apps to force your app's termination. After that open the app and check the logs, there should be some kind of indication what caused the Flutter UI freeze.

like image 178
mgapinski Avatar answered Sep 17 '22 20:09

mgapinski