Software Archive
Read-only legacy content
17061 Discussions

Not able to get any notification in the phone using Push Notification Plugin in intel XDK

Anjali_P_
Beginner
413 Views

Hiii,

I am creating an sample app for push notification in intel XDK. I am using Intel XDK 2807 with CLI 5.1.1 . I have used push notification as third party plugin and used as imported from Git Repo where I included the following details :

Repo URL : https://github.com/phonegap/phonegap-plugin-push

Git Ref : 1.4.3

The plugin was added successfully.....

The following is the index.html contain : 

<!DOCTYPE html>
<html>
<head>
    <title>Push Notification Sample</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <style>
      @-ms-viewport { width: 100vw ; zoom: 100% ; }  @viewport { width: 100vw ; zoom: 100% ; }
        @-ms-viewport { user-zoom: fixed ; }           @viewport { user-zoom: fixed ; }
    </style>
    <script src="cordova.js"></script>   
    <script src="js/app.js"></script>    
    <script src="xdk/init-dev.js"></script> 
    <script src="js/main.js"></script>       
</head>
<body>
    <input type='button' value='OnClick' id='btn1' onclick='pushNotify();'/>
    <br>
</body>
</html>

The following is the main.js contain : 

function pushNotify()
{
    var pushObj = PushNotification.init({
    android: {
        senderID: "xxxxxxxxxxxxxx" // got the Sender ID from google developer console.
    },
    ios: 
      {
        alert: "true",
        badge: "true",
        sound: "true"
        },
    windows: {}
    });  
    pushObj.on('registration', function(data)
    {
       alert('success : '+data.registrationId);
    });
    pushObj.on('notification', function(data) 
    {
        alert('notification DATA : '+JSON.stringify(data));
        alert('Data Message : '+data.message);
        alert('Data Title : '+data.title);
        push.finish(function () {
           alert('finish successfully called');
        });
    });
     pushObj.on('error', function(e) {
        alert('Error Message : '+e.message);
    });
}

I have build the .apk file and installed in the phone.

On click of button , I am able to get Registration ID.

For testing push notification, I have used online GCM tool from the following link : http://techzog.com/development/gcm-notification-test-tool-android/

In this link , I have provided the proper server API key and Registration ID. On submitting these details, I am getting a success message along with multicast id and message id.

But didn't receive any notification in the phone.

Please help me or suggest something whether I am wrong somewhere and provide a solution .... Reply as soon as possible..

Thanks In Advance...

Regards,

Anjali Paria.

0 Kudos
4 Replies
PaulF_IntelCorp
Employee
413 Views

Looking at the plugin.xml file for that plugin, it appears that it only supports Windows universal apps. This, it will only support Windows Phone 10 devices. Our current Windows Phone build system does not build Windows Phone 10 apps. You can use the EA version to build a Windows 10 universal app, which will run on Windows Phone 10 devices, but it will not run on Windows Phone 8.x devices.

Note, this is a Cordova and Microsoft limitation, this is not something we can change with the XDK.

0 Kudos
Anjali_P_
Beginner
413 Views

Thanks a lot for your information.

But I have got the notification event triggered after the successful registration.  

I have one more question ..

I want to create this push notification app with one background service so that user can get the notification even the app is not open.

Just like WhatsApp Notification.

Is it possible in intel XDK to create an app which can have one background service for android?

If anyone knows the answer .. Please reply as soon as possible.

0 Kudos
John_H_Intel2
Employee
413 Views

This would depend on the plugin you are using. I cant speak for this plugin, but I have used PushWoosh previously and their plugin does allow you to get push notifications in the background. So I would check the documentation for the plugin.

0 Kudos
Thomas_B_6
New Contributor I
413 Views

I used the onesignal push service with the XDK,works pretty well.

Easy to setup, bunch of functionality,and it is 100% free.

(I have no relation to these guys)

0 Kudos
Reply