- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok so far, i have the plugin imported and the compilation log says it is correctly installed, but my problem is the code, i got to the examples provided by pushwoosh on their site but i cant seems to get this to work, device plugins and xdk device plugins aswell as notification plugins on the cordova plug in section are enabled and installed without problem.
i've looked onto this IDZ for any such related topic, but there is only one result when you use "pushwoosh" on the search field.
the code i'm using for my app is the very basic they provide on their guide here:
https://www.pushwoosh.com/programming-push-notification/ios/ios-additional-platforms/push-notification-sdk-integration-for-phonegap/
if someone is out there and have managed to correctly install and config pushwoosh onto xdc cordova, please shed a bit of knowledge with me, practically after all troubles solvented with the cordova building, the push notifications are the only thing left, in order to finish my app...
help would be very appreciated.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attached is my index.html file. Just update line 61 with what pushWoosh gives you for your app.
As far as plugins, I only have Cordova Device and Splash Screen selected, and the 3rd party PushWoosh added.
I am guessing the main issue you are having is with the Cert and p12 though right? There are tutorials on PushWoosh website that walk you through how do do it. If your still in the 2 week trial period for them, you can use their auto feature (but you must supply them with your apple id and password).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Implementing the required code is fairly easy.
in your index.js file do this: (just be careful I'm only showing the onDeviceReady method of that singleton class.)
onDeviceReady: function() { app.receivedEvent('deviceready'); initPushwoosh(); },
then on a separate file: (just make sure to load it before index.js)
function initPushwoosh() { if((device.platform).toLowerCase == "ios"){ var pushNotification = window.plugins.pushNotification; //set push notification callback before we initialize the plugin document.addEventListener('push-notification', function(event) { //get the notification payload var notification = event.notification; //display alert to the user for example alert(notification.aps.alert, "Error"); //clear the app badge pushNotification.setApplicationIconBadgeNumber(0); }); //initialize the plugin pushNotification.onDeviceReady({pw_appid:"your PW app ID"}); //register for pushes pushNotification.registerDevice( function(status) { var deviceToken = status['deviceToken']; console.warn('registerDevice: ' + deviceToken); alert('registerDevice: ' + deviceToken); }, function(status) { console.warn('failed to register : ' + JSON.stringify(status)); alert(JSON.stringify(['failed to register ', status])); } ); //reset badges on app start pushNotification.setApplicationIconBadgeNumber(0); }else if((device.platform).toLowerCase == "android"){ var pushNotification = window.plugins.pushNotification; //set push notifications handler document.addEventListener('push-notification', function(event) { var title = event.notification.title; var userData = event.notification.userdata; if(typeof(userData) != "undefined") { console.warn('user data: ' + JSON.stringify(userData)); } alert(title); }); //initialize Pushwoosh with projectid: "GOOGLE_PROJECT_NUMBER", pw_appid : "PUSHWOOSH_APP_ID". This will trigger all pending push notifications on start. pushNotification.onDeviceReady({ projectid: "Google project No.", pw_appid : "PW app id" }); //register for pushes pushNotification.registerDevice( function(status) { var pushToken = status; console.warn('push token: ' + pushToken); }, function(status) { console.warn(JSON.stringify(['failed to register ', status])); } ); } }
You may want to change the navigator alerts for native notifications if you haven't done so. If building for a single platform just remove the code inside the correspondent if statement and discard the rest. The real tricky part is getting the .p12 file from the Apple tools. Pushwoosh have a couple of guides for doing it two ways installing SSL on your machine or with the accessory keys tool on a Mac.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
john, indeed i used that feature, so the only thing left is the code and plugins, i'll remove all other plugins and just leave the ones you mention, plus using the code on the file you provided, aswell as using the code alfredo provided in case it fails, so its test time, i will post the results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
still nothing, both codes implemented and no response, but now something started to pick my curiosity.
on the legacy builds you had an asset tab required for push messaging where you add your ios aps_production.cer file certificate, i was thinking after making a new app for testing purposes, in cordova app build, where do you include the aps_production.cer file???
since in my trouble app i already did that part for the legacy builds i did took it for granted that the app was taking that cert from that option. but now it seems likely not.
in the iOS build options tab there is only space for the ios distribution cert and not the push cert, any idea on how this works? may this be the thing i'm missing??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yep mr JOHN it worked like a charm, my mistake was in the provisioning file, the order i was using was wrong, your video pointed that out, very clear (i bet you were cursing me over the audio "ahh damn u n00b" and had to supress it!
just kidding haha, thanks for taking the time to do this video guide, and sorry for keep being a pain on some publications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi John,
Any chance you might have a video on how to configure pushwoosh with android? I will really appreciate it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i can help you with that (its my time to share the knowledge ive learned)
for android u dont need anything extra, the only 5 things u need are:
1.- create an android developer account, and generate a project, it will give you the project id (indicated on the android developer console)
2.- activate google push service onto that project (inside the project settings)
3.- add the id mentioned earlier on the pushwoosh project config part for android
4.- add the pushwoosh plugin to XDK
5.- the pushwoosh android code for xdk onto the HEAD tag of your index.html (wich includes both your android project ID (XXXXXXXXXXXX) and your pushwoosh project number (XXXX-XXXX) [iOS only needs the pushwoosh project id onto its code, exposed below]) you dont need to create any JS file or extra file)
i'm suppousing you know already the android developer stuff so ill skip that, the project id is a 12 digit number.
i'll post the xdk codes i'm using, for android and ios, everytime i create a build, i use the required (desired) code (android or ios) and it works like a charm.
<!-- ANDROID PUSH CODE START -->
<script> function initPushwoosh() { var pushNotification = window.plugins.pushNotification; document.addEventListener('push-notification', function(event) { var title = event.notification.title; var userData = event.notification.userdata; if(typeof(userData) != "undefined") { console.warn('user data: ' + JSON.stringify(userData)); } alert(title); }); pushNotification.onDeviceReady({ projectid: "XXXXXXXXXX", pw_appid : "XXXXX-XXXXX" }); pushNotification.registerDevice( function(status) { var pushToken = status; console.warn('push token: ' + pushToken); }, function(status) { console.warn(JSON.stringify(['failed to register ', status])); } ); } </script> <script> function init() { document.addEventListener("deviceready", initPushwoosh, true); } </script> <!-- ANDROID PUSH CODE END -->
<!-- IOS PUSH CODE START --> <script> function onDeviceReady() { if( navigator.splashscreen && navigator.splashscreen.hide ) { navigator.splashscreen.hide() ; } if( window.intel && intel.xdk && intel.xdk.device ) { if( intel.xdk.device.hideSplashScreen ) intel.xdk.device.hideSplashScreen() ; } initPushwoosh(); } document.addEventListener("deviceready", onDeviceReady, false) ; function initPushwoosh() { var pushNotification = window.plugins.pushNotification; document.addEventListener('push-notification', function(event) { var notification = event.notification; alert(notification.aps.alert); pushNotification.setApplicationIconBadgeNumber(0); }); pushNotification.onDeviceReady({pw_appid:"XXXXX-XXXXX"}); pushNotification.registerDevice( function(status) { var deviceToken = status['deviceToken']; console.warn('registerDevice: ' + deviceToken); }, function(status) { console.warn('failed to register : ' + JSON.stringify(status)); alert(JSON.stringify(['failed to register ', status])); } ); pushNotification.setApplicationIconBadgeNumber(0); } </script> <!-- IOS PUSH CODE END -->
hope this shed some light to you as JOHN did to me (along with some curses onto his thoughts ;D)
P.S.: ALL THIS IS FOR CORDOVA BUILDS, LEGACY GOT MESSED UP ON MY END AND I HAD TO SWITCH TO IT)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I'm trying to use pushwoosh in iOs cordova project.
Everything works well, but I'm not able to put custom sound. In pushwoosh test platform they say to indicate the name of my sound in the "main bundle" of the app (see attachment).
Well, I tried to put my .wav file in so many folders (starting from base), but it not working. I have index.html in the main folder (not www).
Please help me!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would try different sound types, ogg, ect. I have not read their docs on which types they allow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JOHN H. (Intel) wrote:
I would try different sound types, ogg, ect. I have not read their docs on which types they allow.
ok did you try? any sound that work? where I have to put sound files? thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have not tried. With 3rd party plugins, you need to check the documentation the author of the plugin provides. If there are issues, you need to submit a bug request with them.

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