Push Notification not working

2 posts, 0 answers
  1. Abhishek
    Abhishek avatar
    7 posts
    Member since:
    Jul 2012

    Posted 07 Aug 2013 Link to this post


    I am trying to use the Everlive Push Notification without the MVVM template that it comes with. The approach i have taken is to remove the reference of main.js from index.html and include a different js file to host my code. I don't think MVVM should be essential for using Push Notifications.

    The code that i currently have is as follows:

    "use strict";
    document.addEventListener("deviceready", onDeviceReady, false);

    // PhoneGap is ready
    function onDeviceReady() {
         var app = new kendo.mobile.Application(document.body);
        var el = new Everlive('xxxxxxxx');

        var currentDevice;
       var successCallback =  function(arg) {
            alert('Device already registered');
            currentDevice= arg;
            //el.push.currentDevice().getRegistration(successCallback, function() {alert("Registering the device.");currentDevice = el.push.currentDevice();});

    var pushSettings = {
                badge: true,
                sound: true,
                alert: true
                senderID: '55555555555555
            notificationCallbackIOS: function(e){
                alert('Initialized successfully' +  + JSON.stringify(e));
            notificationCallbackAndroid: onAndroidPushReceived

    el.push.currentDevice().enableNotifications(pushSettings, function() {alert('Initialized successfully');}, function() {alert('Initialization error');});

    var onAndroidPushReceived = function(args) {
        alert('Notification Received');
                alert('Android notification received: ' + JSON.stringify(args)); 

    function registerInEverlive() {
        alert("Starting REgistration");
         var el = new Everlive('xxxxxxxxx');
       // el.push.currentDevice().register({ Group: 15 }, function() {alert('Registered successfully');}, function() {alert('Registeration NOT successfully');});
        var currentDevice = el.push.currentDevice();
                if (!currentDevice.pushToken) currentDevice.pushToken = "some token";
                    .register({ Age: 15 })
                        function() {
                            alert('Device registered with Everlive');
                        function(err) {
                            alert('REGISTER ERROR: ' + JSON.stringify(err));

    With the above code i am able to register Android device on Everlive (and i am able to confirm the same from the portal). However, any push notification that i send from the portal is not reaching the device. I have supplied the Everlive key, Google API Project ID in the code above. In the Everlive portal, I am using the Server Key (of GCM). 

    Earlier, using the template the notifications were able to reach the device. 

    Abhishek Kant
  2. Lyubomir Dokov
    Lyubomir Dokov avatar
    44 posts

    Posted 12 Aug 2013 Link to this post

    Hello Abhishek,

    MVVM is definitely not required for push notifications. Your code seems fine. I assume that you replaced google project ID and your API key with fake values just for the post.

    Can you check the push token for the registered device in the portal? Does it seem like a valid push token? You can try if the token itself is valid by using this app:

    This will help us narrow down the problem area - is it a problem with the push token(e.g. with the registration) or is it some server issue with sending the notification to GCM.

    Lyubomir Dokov

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
Back to Top