@Honey_Hunters wrote:
Hello!
Im working on my own php backend service for push notifications.
For IOS i use APNS and everything works fine!
For Android i use GCM api and i have one problem^
If i send push, while my device is awake and my App is active now, i can catch onNotification event in app,
BUT if android device is asleep or my app isnt active now then i received push, but when i click on it i get my APP loaded, but without onNotification event.
BUT if i use IONIC push service and send notification, i get push and catch onNotification event in app in both conditions
WHO CAN HELP ME??? ))))function onDeviceReady() { var io = Ionic.io(); var user = Ionic.User.current(); var onNotification = function(e) { alert('check onNotification fnction'); }; var push = new Ionic.Push({ "debug": false, "pluginConfig": { "ios": { "badge": true, "sound": true, "clearBadge": true }, "android": { "sound": true, "vibrate": true, "forceShow": true, "ecb": 'onNotification', "senderID": "MY_SENDER_ID" } }, "onNotification": function(notification) { onNotification(notification); }, "onError": function(err) { alert(err); } }); var registerCallback = function(token) { push.saveToken(token); app_token = token.token; // this parameter i send to my service, to send pushes device = (ionic.Platform.isAndroid()) ? 'Android':'IOS'; // this parameter i send to my service, to send pushes user.save(); Ionic.User.current(user); }; push.register(registerCallback); } document.addEventListener("deviceready", onDeviceReady, false);
Posts: 1
Participants: 1