How to avoid disappearing of the next alarm time on the lock screen?
<p>I'm writing an alarm clock application.
In my application I put the next alarm time to the lock screen this way:</p>

<pre><code>Settings.System.putString(context.getContext().getContentResolver(),
                Settings.System.NEXT_ALARM_FORMATTED, systemAlarmString);
</code></pre>

<p>And set the system alarm icon into the right side of the notification bar this way:</p>

<pre><code>Intent alarmChanged = new Intent("android.intent.action.ALARM_CHANGED");
alarmChanged.putExtra("alarmSet", showSystemAlarmIcon);
context.getContext().sendBroadcast(alarmChanged);
</code></pre>

<p>And put the program icon into the left side  of the notification bar via the NotificationManager</p>

<p>When my program set the next alarm time everything is fine.
But some time after my closing the program the next alarm time on the lock screen and system alarm icon at the right side of the notification bar disappears.
The notification icon in the left side of the notification bar doesn't disappear.</p>

<p>I found out that it is not my program who remove next alarm. I try to always set the constant string to the lock screen and always show system alarm icon. Nevertheless they disappears: lock screen shows empty string and system alarm icons become hided.</p>

<p>I guess, some other programm do it. But I can't detect it.</p>

<p>My test phone is Samsung Galaxy S. On the emulator everything works fine but there is not third part program there.</p>

<p>I've found the problem.</p>

<p>Standard alarm clock sometimes clears the next alarm time.
There is no alarm in the standard alarm clock but sometimes it wakes up and make his bad things :)</p>

<p>The solution in my case is to catch the "android.intent.action.ALARM_CHANGED" intent and restore the next alarm data sometime later. </p>
