I have an AtomicBoolean in my service class for an android app. I wanted to monitor the variable have it shut down a media player if the value is false and keep it running if the value is true. which of the lifecycle methods should i put this testing while loop in?
Share
If you want to monitor, then you would want to set up a recurring timer in the
onStartCommand()method of theServiceclass. Keep in mind that this puts the responsibility on you to stop the Service when your work is finished.