How to send Push Notification in Android Hybrid Application using built on Ionic Framework.
I am Newbie, Please Guide me Step by Step how to send Push notification in ionic?
I saw a different tutorials on youtube and other websites but i am confused where to add those code which shown on these website. I have GCM Project Number (SENDER_ID) but dont know where to put it.
Please Guide In details.
Thanks in Advance.
-
2devdactic.com/ionic-push-notifications-guideDivyesh Savaliya– Divyesh Savaliya2016-09-05 11:09:55 +00:00Commented Sep 5, 2016 at 11:09
-
I did same as described in this tutorial... but still I am confused and didn't get it. Or may be i am doing something wrong..Najam Us Saqib– Najam Us Saqib2016-09-06 10:52:26 +00:00Commented Sep 6, 2016 at 10:52
Add a comment
|
1 Answer
Try using phonegap-plugin-push ? It is easy to implement and use.
Config :
var push = PushNotification.init({
"android": {
"senderID": "Your-sender-ID",
"forceShow": true, // To show notifications on screen as well
"iconColor": "#403782",
"badge": "true",
"clearBadge": "true" // To clear app badge
},
"ios": {
"alert": "true",
"badge": "true",
"clearBadge": "true",
"sound": "true",
"forceShow": "true"
},
"windows": {}
});
Device Registration :
push.on('registration', function(data) {
localStorage.setItem('pushToken', data.registrationId); // Save registration ID
});
Handle Notifications
push.on('notification', function(data) {
console.log(data);
// Handle all requests here
if (data.additionalData.$state == "mystate") {
$state.go('app.conversations');
}
})
1 Comment
Sangwin Gawande
That's okay, someone might need this in future.