admin管理员组文章数量:1026989
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.
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.
本文标签: flutterKeep same data available in a Android app when openmaximised and minimisedStack Overflow
版权声明:本文标题:flutter - Keep same data available in a Android app when openmaximised and minimised - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745651900a2161369.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论