2
1

I have a code that worked until some days ago, but now it isn't working anymore, but, even i not receiving the notification, the response says that the message was sent OK.

The code:

    $pushwoosh = \Gomoob\Pushwoosh\Client\Pushwoosh::create();
    $pushwoosh->setApplication('app_id_push_notification');
    $pushwoosh->setAuth('auth_token_push_notification');

    $notif = \Gomoob\Pushwoosh\Model\Notification\Notification::create();
    $notif->setContent('test');

    $finalData = array();
    $finalData['something'] = 'blablabla';

    $notif->setData($finalData);
    $notif->setSendDate('now');
    $notif->addDevice('iddevice');

    $request = \Gomoob\Pushwoosh\Model\Request\CreateMessageRequest::create()->addNotification($notif);
    $response = $pushwoosh->createMessage($request);

    print_r($response);

The response is:

Gomoob\Pushwoosh\Model\Response\CreateMessageResponse Object ( [response:Gomoob\Pushwoosh\Model\Response\CreateMessageResponse:private] => Gomoob\Pushwoosh\Model\Response\CreateMessageResponseResponse Object ( [messages:Gomoob\Pushwoosh\Model\Response\CreateMessageResponseResponse:private] => Array ( [0] => CODE_NOT_AVAILABLE ) ) [statusCode:protected] => 200 [statusMessage:protected] => OK )

Does anyone has any idea why the message is not coming in the device? (The same code was working before...)

Thanks in advance.

asked 20 Jun, 19:10
Lucas's gravatar image

Lucas
411

I'm having the same issue.

PLUS new device registrations are not getting into the PW database, so all pushes to recently registered devices are NOT working.

permanent link
answered 22 Jun, 17:36
Earl's gravatar image

Earl
114

1

In your case just new devices doesn't receives the push? Or the oldest devices doesn't receive too? In my case, there isn't any device receiving the push...

(22 Jun, 20:31) Lucas Lucas's gravatar image

Something similar happening here. 3 different users that are all magically unknown/expired/unsubscribed in the PushWoosh system without the users actually taking any action to unregister.

Can't reproduce it myself, but might be because my device is already known in the system for a long time.

(27 Jun, 08:47) netwerkapp netwerkapp's gravatar image

Same for me too. iOS only started happening I'd say June 15 - our client was testing so noticed it right away.

Our App uses Cordova 6.2.0 and pushwoosh-cordova-plugin 5.1.2 (pretty old)

Here's what we've learned:

  1. Effects only iPhone SE, 6 and 7. iPhone 5 is unaffected
  2. Not dependent on iOS version. Some folks have latest, others a bit older
  3. Response from createMessage is: { "status_code": 200, "status_message": "OK", "response": { "Messages": [ "CODE_NOT_AVAILABLE" ], "UnknownDevices": { "": [ "ffffde32876dfe1197088d2d556e0a72f73610476bab57b0025f69c0a6f4ffff" ] } } }

"UnknownDevices" bit is the problem - registerDevice is failing.

...but... if you use https://github.com/noodlewerk/NWPusher to send the message direct to Apple - it works fine.

I think they've upgraded something behind the scenes that breaks registerDevice but their dev team says the only problem is the version of the Pushwoosh SDK is too old.

I have a workaround of sorts.

I do an extra call to registerDevice to force it. This seems to work 90% of the time. Only trick is to reformat the hwid that you get from a iPhone 6 or 7 to the same format that you get from a 5. In JavaScript:

         function ForceRegisterDeviceiOS(pushwooshAppId, token) {

            window.plugins.pushNotification.getPushwooshHWID(
                function(hwid) {

                    if(hwid.length === 32 && hwid.indexOf('-') === -1) {
                        //reformat iPhone 6/7 hwid as iPhone 5 ones
                        //e.g. 0f607264fc6318a92b9e13c65db7cd3c to 0F607264-FC63-18A9-2B9E-13C65DB7CD3C
                        hwid = "{0}-{1}-{2}-{3}-{5}".format(hwid.substr(0,8), hwid.substr(8,4), hwid.substr(12,4),  hwid.substr(16,4),  hwid.substr(20,12)).toUpperCase();
                    }

                    var data = {
                        request :{
                            application:pushwooshAppId,
                            push_token:token,
                            hwid: hwid,
                            device_type:1
                        }
                    };

                    var headers = {
                        'Content-Type': 'application/json'
                    };

                    $.ajax({
                        url: "https://cp.pushwoosh.com/json/1.3/registerDevice",
                        type: 'POST',
                        dataType: 'json',
                        headers: headers,
                        data: JSON.stringify(data),
                        success: success,
                        error: error
                    });
                }
            );

        }
permanent link
answered 23 Jun, 17:11
benwilson's gravatar image

benwilson
312

In my case, many devices that registered some time ago are still receiving pushes. We've had working code for a over a year.

But for some people, the pushes have stopped working. Those people have tried reinstalling our app so their device registers again. For all those people, and new signups -- for anybody who registers a new device -- pushes are not working and I know that the device HWID is not getting in to the PW database.

This is for iOS only and I believe the problem started recently.

permanent link
answered 22 Jun, 23:57
Earl's gravatar image

Earl
114

Ben,

We are still having this issue. Did you update your version of pushwoosh-cordova-plugin?

We did, and now I'm not sure if we should be using HWID or device token. After updating we see HWIDs that look right (dashes and the new format) but on the PushWoosh control panel we get no report after sending a push. They've told me before that that means the device was not found in their database.

How are we supposed to test an iOS device anyhow? If we build with production certificates, I'm not sure how we run that build on iOS. If we build in Sandbox, that's no good because I can't change my control panel to Sandbox mode or all the current users will not receive pushes, right?

I must be doing something wrong.

permanent link
answered 23 Jun, 19:32
Earl's gravatar image

Earl
114

Hi Earl,

If it returns something like:

{ "status_code": 200, "status_message": "OK", "response": { "Messages": [ "CODE_NOT_AVAILABLE" ] } }

...then that's good. Even though it looks bad. You have to turn on debug mode to get it to be more vebose (only lasts for 1 hour before auto turns off)

The bad message is:

{ "status_code": 200, "status_message": "OK", "response": { "Messages": [ "CODE_NOT_AVAILABLE" ], "UnknownDevices": { "": [ "ffffde32876dfe1197088d2d556e0a72f73610476bab57b0025f69c0a6f4ffff" ] } } }

...that means they can't find the token in their database because registerDevice has failed somehow.

What we did to handle the whole production vs. sandbox thing is to create two Pushwoosh Applications. One for Production and one for sandbox. Then in our dev builds we use the sandbox Pushwoosh Application ID but for Production we use the production Pushwoosh Application ID

You have to use token not hwid to send. hwid is just used by them I think so they can uniquely identify a device when it registers. hwid can't change but token can.

Interesting that you've updated and still having problems. If you could capture what the device is sending for registerDevice using http://www.telerik.com/fiddler I'd love to see what the new SDK sends versus my one. I'll be happy to help you set it up. My skype is ben.wilson and I'm on the west coast (North America).

My gut feel is that they have some kind of load-balancing issue which is causing intermittent registerDevice failures.

permanent link
answered 23 Jun, 20:13
benwilson's gravatar image

benwilson
312

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:

×402
×302
×30

question asked: 20 Jun, 19:10

question was seen: 152 times

last updated: 27 Jun, 08:47