Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I save data from Android service?

I have a service that collects data, can I save the data in case of reboot or any other action that will restart the service, and how can I do it?

like image 507
Alex Kapustian Avatar asked Feb 23 '23 17:02

Alex Kapustian


1 Answers

Can I save the data in case of reboot or any other action that will restart the service

You will not necessarily find out when those sorts of events will occur. Save your data as you go.

And how can I do it?

Use a file. Or a database, which is a type of file. Or a SharedPreferences structure, which is backed by a type of file.

like image 174
CommonsWare Avatar answered Feb 26 '23 06:02

CommonsWare