Windows Phone 8.1 中的报警代码 [英] Alarm code in Windows Phone 8.1

查看:23
本文介绍了Windows Phone 8.1 中的报警代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 Toast 通知编写了带有未来提醒功能的应用程序,我可以通过 BackgroundTask 每次提醒

I have code the app with future Reminder by Toast notification , i can remind every times by BackgroundTask

但我想在每天的某个时间提醒:每天下午 4 点

But i want to reminder at one time in every day like : 4.00 PM every day

我搜索并获取有关警报和提醒的信息已超出 Windows Phone 8.1

I search and get info about Alarm and Reminder are out of Windows Phone 8.1

还有别的方法吗?

对不起我的英语不好

推荐答案

您可以使用预定的 Toast 通知在特定时间触发 Toast.这不需要在 toast 触发时运行应用,仅在安排 toast 时运行.

You can use a scheduled toast notification to fire a toast at a specific time. This doesn't require the app be running when the toast fires, only when the toast is scheduled.

您需要为每一天安排单独的祝酒仪式,因为没有自动重复.如果用户可能会频繁运行应用程序,那么您可以在应用程序运行时安排接下来的 30 天左右.另一种选择是设置一个MaintainanceTrigger 后台任务,以便在应用插入时每隔一段时间安排一次接下来的30 天.

You will need to schedule individual toasts for each day as there is no automatic repetition. If the user is likely to run the app frequently then you can schedule the next 30 days or so whenever the app runs. Another option is to set a MaintainanceTrigger background task to schedule the next 30 days every so often when the app is plugged in.

            // Today, 4:00pm
        DateTime now = DateTime.Now;
        DateTime dueTime = new DateTime(now.Year, now.Month, now.Day, 16, 0, 0);
        ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();

        for(int i=0;i<30;i++)
        {
            dueTime.AddDays(1);
            XmlDocument toastXml = SetupMyToast(dueTime);

            ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml, dueTime);
            toastNotifier.AddToSchedule(scheduledToast);
        }

有关详细信息,请参阅快速入门:发送 Toast 通知(XAML) 以及如何安排 Toast 通知

For more details see Quickstart: Sending a toast notification (XAML) and How to schedule a toast notification

这篇关于Windows Phone 8.1 中的报警代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆