开发者

How to persist data in a broadcast receiver

开发者 https://www.devze.com 2023-04-07 14:36 出处:网络
I have a simple broadcast receiver which receives some data which I would like to store for the application to use on next launch. It is just a few strings so simplicity is the goal. Normally I\'d jus

I have a simple broadcast receiver which receives some data which I would like to store for the application to use on next launch. It is just a few strings so simplicity is the goal. Normally I'd just write to to a file or sharedPreferences but 开发者_高级运维not being an activity that seems incorrect.

Thoughts?

-- Henry


Saving into SharedPreferences is perfectly fine. You have a Context to access it from as it is passed into the BroadcastReceiver.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号