android - Using Service to share/persist data across Activities -
i've been looking @ options available me persisting data across activities
. i've searched bit online , found few methods other people seem use. of them -
- intent
- singleton class
- disk
application
what using service
? haven't found anywhere use of service data persistence across activities mentioned. i've experienced android service, i'm pretty sure can used purpose. there reason why others, far know, not use service data persistence?
of course can that, more overhead (and need write more code, , need understand more android).
in case, service
isn't more "persistent" using public static
variables (which pretty same using application
class or singleton). if android needs resources, or app hasn't been used in while, or phone having bad day, android kill os process hosting service
, singleton, application
class , public static
variables. if want more "persistent" that, you'll need use database, shared preferences or file.
Comments
Post a Comment