SHARE
TWEET

pushwoosh registering

a guest Jan 11th, 2017 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function initPushwoosh() {
  2.   if(typeof cordova !== "undefined"){
  3.     var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
  4.     console.log('initPushwoosh');
  5.     // Should be called before pushwoosh.onDeviceReady
  6.     document.addEventListener('push-notification', function(event) {
  7.       var notification = event.notification;
  8.       // handle push open here
  9.       console.log("push-notification event");
  10.     });
  11.  
  12.     // Initialize Pushwoosh. This will trigger all pending push notifications on start.
  13.     pushwoosh.onDeviceReady({
  14.       appid: "52F57-AB146"
  15.     });
  16.  
  17.     pushwoosh.registerDevice(
  18.       function(status) {
  19.         console.log('registerDevice');
  20.         var pushToken = status.pushToken;
  21.         console.log(pushToken);
  22.       },
  23.       function(status) {
  24.         console.log('registerDeviceError');
  25.         console.log(status);
  26.       }
  27.     );
  28.   }
  29. }
RAW Paste Data
Top