Hi Everyone,
I'm calling a service from an activity. That activity has a button to start the service and another button to stop it. In the called service I'm using SetExactAndAllowWhileIdle to reschedule the service so it continues to run. Same thing happens when using StartServiceAtExact from within the same service.
The user also wants to tap the stop button to stop that service and not allow it to reschedule itself until the start button is tapped. In my code I call StopService and it does stop the service but it still wakes up at the scheduled time.
Can you tell me what coding I need to cancel the scheduled part of the service as well? Seems like there may be some sort of queue that needs to be emptied first through coding.
In the mean time I think I will set some flag to stop the code in the service from executing based on the button tapped.
Thanks.
I'm calling a service from an activity. That activity has a button to start the service and another button to stop it. In the called service I'm using SetExactAndAllowWhileIdle to reschedule the service so it continues to run. Same thing happens when using StartServiceAtExact from within the same service.
The user also wants to tap the stop button to stop that service and not allow it to reschedule itself until the start button is tapped. In my code I call StopService and it does stop the service but it still wakes up at the scheduled time.
Can you tell me what coding I need to cancel the scheduled part of the service as well? Seems like there may be some sort of queue that needs to be emptied first through coding.
In the mean time I think I will set some flag to stop the code in the service from executing based on the button tapped.
Thanks.
Last edited: