Q:

Android AlarmManager BroadcastReceiver not working when user exits the application

I'm having some problems with a BroadcastReceiver that is supposed to react on an AlarmManager notification.  I've read several threads on this subject but coulnd't find anything that would help.  I must be missing something. 
I set up the alarm the following way:
// Receiver intent
Intent intent = new Intent(mContext, CalendarAlarmReceiver.class);
intent.putExtra(CalendarAlarmReceiver. SHOW, show);
// Sender
PendingIntent sender = PendingIntent.getBroadcast(mContext, hashRequestCode(show), intent, PendingIntent. FLAG_UPDATE_CURRENT);
mPendingAlarmRequests.put(show.getChannel() + show.getName() + show.getStart().toGMTString(), sender);
// Get AlarmManager
AlarmManager am = (AlarmManager) mContext.getSystemService(Context. ALARM_SERVICE);
am.set(AlarmManager. RTC_WAKEUP, show.getStart().getTime(), sender);

I created an CalendarAlarmReceiver class that extends BroadcastReceiver.  In the onReceive() method I start a status bar notification that works fine if the application is running.  However, if I exit the application by clicking the back button until it closes, the notifications no longer appear. 
I'm not sure if the receiver is called at all and it's just the notification that doesn't work or if the receiver is not called.  
It is registered in the manifest file:
<receiver android:name=".calendar. CalendarAlarmReceiver" >
</receiver>

I read that this may not be the receiver's falut but rather the alarm may be cancelled when the application stops.  If that is the case, is the solution to simply set the alarm in a service that is working all the time in the background? 

A:

Alarms are managed by the OS and are generally not cleared when your application 'exits'.  Put some logging in your receiver and watch to logcat output to find out if it is called.  If it is, debug your notification code. 