I have written a very simple Dart/Flutter app for Android which can receive FireBase notifications both when the app is open and also when it is minimised. The problem is that I would like to save the data that have been send as a notification when the app is minimised and it would be shown in the app when it is maximised again. So far what I can tell when running the emulator is that the app has two different memory areas allocated, one when the app is opened/maximised and the other when the app is minimised (in the background).
How can I allocate a variable/memory that is common for the app when it is minimised and is open? Or maybe I need some kind of message service to send data over to the maximised app when it is minimised?
Thanks for have reading this
When running the Android emulator I can confirm that different memory is allocated when minimised and maximised.
I have written a very simple Dart/Flutter app for Android which can receive FireBase notifications both when the app is open and also when it is minimised. The problem is that I would like to save the data that have been send as a notification when the app is minimised and it would be shown in the app when it is maximised again. So far what I can tell when running the emulator is that the app has two different memory areas allocated, one when the app is opened/maximised and the other when the app is minimised (in the background).
How can I allocate a variable/memory that is common for the app when it is minimised and is open? Or maybe I need some kind of message service to send data over to the maximised app when it is minimised?
Thanks for have reading this
When running the Android emulator I can confirm that different memory is allocated when minimised and maximised.
Share Improve this question asked Nov 16, 2024 at 16:33 Assar WestmanAssar Westman 91 silver badge1 bronze badge1 Answer
Reset to default 1When the app isn't foreground, it can be killed for resources at any time. So if you want to do this, you can't use a variable. You have to persist it to disk- a database, a file, a shared preference, a data store, etc. But if it's just in memory, it may not be there when you want it in the future.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745651901a4638315.html
评论列表(0条)