flutter - Keep same data available in a Android app when openmaximised and minimised - Stack Overflow

I have written a very simple DartFlutter app for Android which can receive FireBase notifications both

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 badge
Add a comment  | 

1 Answer 1

Reset to default 1

When 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信