![](/img/trans.png)
[英]how to show the number of notification in the status bar using android phonegap
[英]Phonegap status bar notification, Android, iOS
我使用phonegap,cordova和onsen UI构建应用程序(仅JS,HTML5)。 我们正在使用pusher.com进行推送通知。 如何使用推送服务器向我的应用添加推送通知? 现有的插件使用GCM,Amazon或其他推送服务。 有什么好处? -我在我的应用中收到推送事件
var pusher = new Pusher('MY_SECRET', {
encrypted: false
});
var channel = pusher.subscribe('my_channel');
channel.bind('new_message', function(data) {
//show message in status bar and set app icon badge to 1
});
而我唯一需要的就是设置应用程序图标徽章并在状态栏中显示消息。
没有内置推服务的插件,是否有解决方案? 谢谢。
如您所说:现有推服务的插件可以接收通知,然后在状态栏中引发通知。 因此,这取决于您的发送方式。
这意味着发出通知是本机android的事情。
但是,如果找不到适合您需求的插件,则可以例如通过该插件引发本地通知
例:
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);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.