【问题标题】:Add Task Scheduler添加任务计划程序
【发布时间】:2015-04-20 12:16:25
【问题描述】:

我正在开发一个 Apache Cordova 应用程序,我想知道是否可以将任务添加到调度程序设备。

我必须在特定时间运行警报和通知,我该怎么做?

我考虑向调度器设备添加任务并委派责任。

这可能吗?至少 Android 4.4

谢谢!

【问题讨论】:

    标签: cordova cordova-plugins visual-studio-cordova


    【解决方案1】:

    首先:是的,您当然可以这样做。 Sebastian Katzer 为此编写了一个插件。可以在这里找到:Cordova - Local Notification Plugin

    此插件允许您触发预定事件,例如:每周一早上 6 点触发事件。标准通知的代码如下所示:

    cordova.plugins.notification.local.schedule({
        id: 1,
        title: "Production Jour fixe",
        text: "Duration 1h",
        firstAt: monday_9_am,
        every: "week",
        sound: "file://sounds/reminder.mp3",
        icon: "http://icons.com/?cal_id=1",
        data: { meetingId:"123#fg8" }
    });
    
    cordova.plugins.notification.local.on("click", function (notification) {
        joinMeeting(notification.data.meetingId);
    });
    

    消息看起来像通知 - 可以在此处找到图片:Picture - Katzer Local Notifications

    还有一个 wiki 可以在这里找到:Local Notifications by Katzer Wiki

    希望对你有所帮助!如果您需要更多信息,请告诉我!

    【讨论】:

    • 谢谢,这正是我要找的图书馆。
    猜你喜欢
    • 2020-07-25
    • 2011-05-29
    • 1970-01-01
    • 1970-01-01
    • 2016-10-30
    • 2012-10-23
    • 2011-07-23
    • 1970-01-01
    • 2014-05-14
    相关资源
    最近更新 更多