I have a simple app where i am setting an alarm. The alarm works fine. However, when the alarm is set there is no alarm icon in the right taskbar to let the user know the alarm is active. Im not sure how to do this.
Code snippet
alarmManager = (AlarmManager) context.getSystemService(ALARM_SERVICE);
intent = new Intent(context, AlarmReceiver.class);
pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
alarmManager.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);
What can i do to show an alarm icon in the right taskbar to show the user that the alarm is active. I will need to show/hide this icon depending if the alarm is turned on/off.
Thank you
EDIT
I tried this and it still doesnt work.
AlarmManager.AlarmClockInfo ac= new
AlarmManager.AlarmClockInfo(System.currentTimeMillis(),
pendingIntent);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
alarmManager.setAlarmClock(ac , pendingIntent);
} else {
Intent alarmChanged = new
Intent("android.intent.action.ALARM_CHANGED");
context.sendBroadcast(alarmChanged);
}