Hi there,

I just successfully integrated the plugin on the Android side of my PhoneGap application, but I'm having some trouble with device registration on the iOS side. First, some details:

Plugin Version: com.pushwoosh.plugins.pushwoosh 3.4.6

PhoneGap Version: 4.2.0-0.24.0

I'm pretty much using the stock JS from the example project:

function initPushwoosh() {

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);

    //clear the app badge
    pushNotification.setApplicationIconBadgeNumber(0);
});


//initialize the plugin (Production)
//pushNotification.onDeviceReady({pw_appid:"XXXXX-XXXXX"});
//initialize the plugin (Development)
pushNotification.onDeviceReady({pw_appid:"YYYYY-YYYYY"});

//register for pushes
pushNotification.registerDevice(function(status) {
    var deviceToken = status['deviceToken'];
    console.warn('registerDevice: ' + deviceToken);
},
function(status) {
    console.warn('failed to register : ' + JSON.stringify(status));
    navigator.notification.alert(JSON.stringify(['failed to register ', status]));
});

pushNotification.setApplicationIconBadgeNumber(0);

pushNotification.getTags(function(tags) {
    console.warn('tags for the device: ' + JSON.stringify(tags));
},
function(error) {
    console.warn('get tags error: ' + JSON.stringify(error));
});

pushNotification.getPushToken(function(token) {
      console.warn('push token device: ' + token);
 });

pushNotification.getPushwooshHWID(function(token) {
    console.warn('Pushwoosh HWID: ' + token);
});
}

On launch, the console looks like this:

[Warning] failed to register : null
[Warning] get tags error: null
[Warning] push token device: LONG_DEVICE_TOKEN
[Warning] Pushwoosh HWID: LONG_HWID
[Warning] tags for the device: {"Application Version":"1.3.0","First Install":1422489600,"City":"us, aurora","Language":"en","Country":"us"}

I'm not sure why I'm failing to register. This is my only iOS device and I can see in the Pushwoosh console that I have one iOS subscriber in my Pushwoosh application. I'm setting a tag elsewhere and the tag appears in the Pushwoosh console as well.

Notifications are enabled on the device and I've double-checked that the certificates and keys are correct for the environment.

Does anyone have any ideas as to where I should be looking to fix this?

asked 30 Jan '15, 00:27
JoshGreco's gravatar image

JoshGreco
112

Developments! Previous attempts to send notifications to the device received "Invalid Token" errors. I just sent another push to the device and the notification was successfully received BUT I'm still getting the "failed to register : null" error.

Should I just ignore the error?

permanent link
answered 30 Jan '15, 00:30
JoshGreco's gravatar image

JoshGreco
112

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×353
×165
×91
×76

question asked: 30 Jan '15, 00:27

question was seen: 1,790 times

last updated: 30 Jan '15, 00:30