I have a service running in my Android app. This service was started using an AlarmManager with a repeating alarm. When a certain event occurs, the service sends out a broadcast, which is received within a Fragment. There the alarm is canceled (alarm.cancel(pendingIntent)).
So far, so good. But what do I do if the activity/fragment gets destroyed? How can I still cancel the service?