- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone!
I'm trying to use Intel XDK for my mobile projects but this is giving me insane problems!
Im trying to use this plugin:
http://plugins.cordova.io/#/package/com.clone.phonegap.plugins.pushplugin
I've installed successfully and and i can register and recieve the regid needed to send to parse.com
The problem is when i try to send a push notification, the onNotification seems to never been called.
Here's my code inside init-app.js:
var pushNotification; pushNotification = window.plugins.pushNotification; var timmer_background; var fName = "app.initEvents():" ; app.consoleLog(fName, "entry") ; window.onNotification = function(e) { $("#app-status-ul").append('<li>EVENT -> RECEIVED:' + e.event + '</li>'); switch( e.event ) { case 'registered': if ( e.regid.length > 0 ) { var postData = { deviceType: 'android', channels: [""], GCMSenderId: 'XXXXXXXXXXXX', pushType: 'gcm', deviceToken: e.regid }; $.ajax({ method: 'POST', url: 'https://api.parse.com/1/installations', data: JSON.stringify(postData), headers: { 'X-Parse-Application-Id': "XXXXXXX", 'X-Parse-REST-API-Key': "XXXXXXXX", 'Content-Type': 'application/json' }}); // Your GCM push server needs to know the regID before it can push to this device // here is where you might want to send it the regID for later use. console.log("regID = " + e.regid); } break; case 'message': // if this flag is set, this notification happened while we were in the foreground. // you might want to play a sound to get the user's attention, throw up a dialog, etc. if (e.foreground) { console.log('MESSAGE YOOO'); } else { // otherwise we were launched because the user touched a notification in the notification tray. if (e.coldstart) console.log('MESSAGE YOOO COLDSTART'); else console.log('MESSAGE YOOO NOT COLSTART'); } break; case 'error': console.log('ERRRO'); break; default: console.log('ERRRO DEFAULT'); break; } }; //DEALING WITH PUSH NOTIFICATIONS if ( device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos" ){ pushNotification.register( successHandler, errorHandler, { "senderID":"411517623649", "ecb":"onNotification" }); } else { pushNotification.register( tokenHandler, errorHandler, { "badge":"true", "sound":"true", "alert":"true", "ecb":"onNotificationAPN" }); }
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My suspicion is that you need to clone this plugin locally and add the respective push notification SDK libraries (the JAR files) into the cloned plugin and then include that local plugin in the XDK (I'm assuming you are referencing the plugin as an external third-party plugin).
See the instructions on the plugin's github page, they are much more clear and easier to read: https://github.com/phonegap-build/PushPlugin
In particular, this paragraph in the automatic installation section of the README.md:
Note: For each service supported - ADM, APNS, GCM or MPNS - you may need to download the SDK and other support files. See the Manual Installation instructions below for more details about each platform.
When you follow that link to the manual installation instructions, it describes how to add the respective JAR files into the cloned plugin. Those files are not included automatically in the plugin because those SDKs probably have "redistribution restrictions" in their licenses, which typically requires that the end user of the SDK be the one that downloads the files.
You should only have to perform the first steps regarding downloading and copying the JAR files, but the instructions assume you are using a local CLI build system, which you are not. I suspect you can copy them to an appropriate spot in the plugin directory, but I'm not sure where without going through the whole process. You might ask the plugin author where those files should be placed into a cloned copy of the plugin.
The rest of the manual instructions look like they are handled automatically by the plugin.xml file, which is the main set of instructions to the build system for incorporating the plugin into your app before the Cordova build takes place.
If that doesn't work, you can also try the PushWoosh plugin, here's a link: http://plugins.cordova.io/#/package/com.pushwoosh.plugins.pushwoosh
Sorry, but I have not personally worked with these third-party plugins, so I'm speculating as to the source of the problem. Your best support will come from the plugin authors and any examples they provide.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page