Windows Phone 7 alarm does not turn off at the appointed time

I am creating an app for Windows Phone OS 7.1 to learn about this platform. While creating my alarm clock app, I ran into this strange error: when I set the alarm using ScheduledActionService.Add (myAlarm), the alarm does not go off at the specified time. I set beginTime = now + 10 seconds, then I waited 2 minutes with no luck. However, when I add another runtime alarm, after the selected last alarm time, the last alarm goes off.

Below is the code for my createAlarm function. I did some searches but couldn't find a solution.

        private void createAlarm(double time, string message)
    {
        var myAlarm = new Alarm(System.Guid.NewGuid().ToString())
        {
            Content = message,
            BeginTime = DateTime.Now.AddSeconds(time),
            ExpirationTime = DateTime.Now.AddSeconds(time + 10.0)
        };

        myAlarm.Sound = new Uri("/Sounds/02 Ha Trang.mp3", UriKind.Relative);
        myAlarm.RecurrenceType = RecurrenceInterval.None;

        ScheduledActionService.Add(myAlarm);
    }

      

+3


source to share


1 answer


This is a known issue. The alarm is triggered with an accuracy of 30 seconds. This is the case with reminders. Sometimes you can get accurate results, but in general it is not reliable to have frequent alarms or reminders. The lack of accuracy is likely to reduce resource consumption. (Remember that alarms run in the background.) The first alarm is triggered when the second is set because the system suddenly "realizes" that the alarm has already expired. It would be good practice to separate them for at least a minute.



On the other hand, if you really need to beep at very small intervals, you will have to use something more "forward" like a timer.

+1


source







All Articles