【问题标题】:How to show status bar notification using Cordova - Android and IOS如何使用 Cordova 显示状态栏通知 - Android 和 IOS
【发布时间】:2017-03-29 02:42:50
【问题描述】:

我阅读了许多关于状态栏通知的博客和 Stackoverflow 线程,并且大部分博客都使用了一个插件 https://github.com/phonegap/phonegap-plugins/tree/master/Android/StatusBarNotification

但这会产生 404 错误。我没有找到任何其他有效的插件来执行此操作。

我需要让下面的代码工作。我需要使用什么插件?

window.plugins.statusBarNotification.notify("Notification", "Registered with Server");

谢谢

【问题讨论】:

  • 尝试报告您所引用的演示站点的链接断开。
  • 所有使用 Cordova 发布状态栏通知内容的博客都有相同的链接。我正在寻找任何其他可用的方式。如果我能找到安装 StatusBarNotification 插件或任何其他解决方法的方法会很有帮助。
  • 请用您所指的博客更新问题。

标签: android cordova push-notification cordova-plugins statusbar


【解决方案1】:

我使用以下插件和代码 sn-p 解决了我的问题。

de.appplant.cordova.plugin.local-notification

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);
});

谢谢。

【讨论】:

  • 谢谢!我一直在寻找相同的东西,并得到了您上面自己的答案的帮助-感谢。不知何故,许多响应者误解了我们需要什么,即:如何在 DEVICE 状态栏(而不是应用的状态栏)上显示本地通知。
【解决方案2】:

您要查找的链接已移至其他位置,此处 -->StatusBarNotification 已弃用

因此,根据您更新的答案,您使用的是正确的插件。

【讨论】:

  • 我认为上面的回复应该在评论中,但我不能不回答就直接做,所以我不得不将其添加为答案
【解决方案3】:

我为 iOS 制作了一个基于 CWStatusBarNotification 的插件,如果你想你可以使用它 CordovaStatusBarNotification

【讨论】:

    猜你喜欢
    • 2015-01-14
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多