how to pass data from activity to running service

后端 未结 4 978
北恋
北恋 2021-02-14 02:33

I want to send data to the server periodically, I\'m using background Service for that, but I want to send when the data got updated, and updated data I\'m getting

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-14 02:59

    The best option would be to persist the data on the hard drive (e.g. SharedPreferences, database, ...).

    Activity got updated => persist to storage => invoke Service

    The Service has to read the data from the chosen storage before sending the data.

提交回复
热议问题