Save data in Broadcast receiver

前端 未结 5 707
半阙折子戏
半阙折子戏 2020-12-11 13:01

I\'d like to maintain a hash table in a broadcast receiver. If I understand BroadcastReceiver\'s life cycle currently it could get killed wiping out my member variables. Wh

5条回答
  •  被撕碎了的回忆
    2020-12-11 13:37

    Your best strategy would be to use a database to store your data in a table instead of any type of in memory Map.

    That way it wouldn't matter if the user turned off and then turned the phone back on again, your data from previous calls would still be available.

提交回复
热议问题