Im using phonegap, cordova and onsen UI to build an application (only JS, HTML5). We are using pusher.com for push-notifications. How can i add push-notifications to my app, using my push-server? Existed plugins use GCM, Amazon or other push-services. What can be good? - i recieve push event in my app
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
});
and only what i need - is to set app icon badge and show message in status bar.
Are there any solutions to do this without plugins with built-in push services? Thanks.
As you said: There are plugins for existing push services which receive the notification and then raise it in the status bar. So it depends on how you send yours.
That means that raising notifications is a native android thing.
However if you can't find a plugin that fits your needs you could raise local notification for example with this plugin
Example:
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);
});