0
在我的Windows Phone 8應用程序中,我使用ScheduledTaskAgent按計劃執行一些代碼。 在任務代碼期間,我立即開始運行警報。我使用下面的代碼做報警報警代碼在後臺任務中引發無效操作異常
Alarm alarm = new Alarm("Test Alarm");
alarm.Content = "My Test alarm";
alarm.BeginTime = DateTime.Now.AddSeconds(2);
alarm.ExpirationTime = alarm.BeginTime.AddSeconds(5);
alarm.RecurrenceType = RecurrenceInterval.None;
alarm.Sound = new Uri("/Assets/Beep.wav", UriKind.RelativeOrAbsolute);
// Add the reminder to the ScheduledActionService
ScheduledActionService.Add(alarm);
在scheduledactionservice添加的地方,我得到下面的異常:
System.InvalidOperationException:BNS錯誤:API只能從前臺應用程序調用。
任何幫助?
明白了,謝謝布萊恩特。 – Mahender