I'm learning how to create a service for my app which downloads a file in background. Why do a Service class is bound to follow a lifecycle like onCreate
, onBind
, onUnbind
, onDestroy
? One straight forward thing I could find is when there is no lifecycle defined for the Service
I would have to do all those jobs manually in my code which would look clumsy and prone to errors. Rather Service
designed in such a way that the code is well organized.
Is there any other purpose or reason for having Service class designed in such a way in Android?
Aucun commentaire:
Enregistrer un commentaire