I am new to android and don't know much about java ...
I have an Activity that creates an ALARM MANAGER and fires alarmManager.setRepeating() , pointing to a Service.
This service in onCreate sets up a partial wakelock to execute all code execution (the application is designed to interact with the user, so the phone is always in standby mode).
All this work is perfect.
Sometimes a service does not have to execute all the code, but exit it before execution. Therefore, I used StopSelf , but I have some doubts:
onDestroy The function in Service has code to remove wakelock. Does this StopSelf() ?
In any case, if I do not specify any function to end the service, after the code is executed, when does it end?
So, in my case, is it better to replace onDestroy() instead of StopSelf() ? a lot thanx!
source share