Pushwoosh / pushwoosh-appcelerator-titanium

Other
33 stars 16 forks source link

Callback nothing reported #11

Closed maxkhrichtchatyi closed 8 years ago

maxkhrichtchatyi commented 8 years ago

Hello, the push message come on the phone but

Ti.API.info('JS message event:' + JSON.stringify(e.data)); 

in callback nothing reported any info.

var pushnotifications = require('com.pushwoosh.module');
Ti.API.info("module is =_ " + pushnotifications);

pushnotifications.pushNotificationsRegister({
    "pw_appid": "ENTER_PUSHWOOSH_APPID_HERE",
    success:function(e)
    {
        setTimeout(function() {
            Ti.API.info('JS registration success event: ' + e.registrationId);
        }, 0);
    },
    error:function(e)
    {
        setTimeout(function() {
            Ti.API.error("Error during registration: "+e.error);
        }, 0);
    },
    callback:function(e) // called when a push notification is received
    {
        setTimeout(function() {
            //push notifications title: e.data.aps.alert
            Ti.API.info('JS message event: ' + JSON.stringify(e.data));
        }, 0);
    }
});
shaders commented 8 years ago

Is it possible to get the logs from the device? So far the information is not sufficient.

maxkhrichtchatyi commented 8 years ago

That's all

[INFO] :   [PW] [I] -[PWRequestManager] 
[INFO] :   x
[INFO] :   |    Pushwoosh request:
[INFO] :   | Url:      https://cp.pushwoosh.com/json/1.3/setBadge
[INFO] :   | Payload:  {"request":{"device_type":1,"badge":0,"application":"xxxx-xxxxx","userId":"xxxxxxxxx","v":"3.0.12.436","hwid":"xxxxxxxxx"}}
[INFO] :   | Status:   "200 no error"
[INFO] :   | Response: {"status_code":200,"status_message":"OK","response":null}
[INFO] :   x
[INFO] :   [PW] [D] -[PushNotificationManager] setBadges completed
[INFO] :   [PW] [I] -[PWRequestManager] 
[INFO] :   x
[INFO] :   |    Pushwoosh request:
[INFO] :   | Url:      https://cp.pushwoosh.com/json/1.3/pushStat
[INFO] :   | Payload:  {"request":{"device_type":1,"hash":"3$","application":"xxxxx-xxxxx","userId":"xxxxxxxxx","v":"3.0.12.436","hwid":"xxxxxxxxx"}}
[INFO] :   | Status:   "200 no error"
[INFO] :   | Response: {"status_code":200,"status_message":"OK","response":null}
[INFO] :   x
[INFO] :   [PW] [D] -[PushNotificationManager] sendStats completed
shaders commented 8 years ago

That's on iOS right? And the push delivers into the open app or you start the app from push? Also what is your Titanium version.

Thanks! That' questions should help identify and fix the problem.

rborn commented 8 years ago

Hi, I get the same.

Os: iOS
Ti SDK: 5.0.2.GA
Pushwoosh module: 1.1.0

(btw, you did a module update but didn't update the module version :wink: )

The app doesn't trigger the callback when you start it from the push notification (tap on the notification) nor when started from the springboard but with one or more notifications pending to be read

Hope this will help you find the issue :smile:

maxkhrichtchatyi commented 8 years ago

Clarification:

Platform: iOS (Titanium Appcelerator)

Step 1st: Launch the app and sign up for notifications. Step 2nd: Turn off the app (Launching an app into the background). Step 3rd: Testing notification - Ti.API.info() works! Step 4th: Kill the app. Step 5th: Testing notification - Ti.API.info() does not work!

var pushnotifications = require('com.pushwoosh.module');
Ti.API.info("module is =_ " + pushnotifications);

pushnotifications.pushNotificationsRegister({
    "pw_appid": "ENTER_PUSHWOOSH_APPID_HERE",
    success:function(e)
    {
        setTimeout(function() {
            Ti.API.info('JS registration success event: ' + e.registrationId);
        }, 0);
    },
    error:function(e)
    {
        setTimeout(function() {
            Ti.API.error("Error during registration: "+e.error);
        }, 0);
    },
    callback:function(e) // called when a push notification is received
    {
        setTimeout(function() {
            Ti.API.info(e);
            Ti.API.info('Success message');
        }, 0);
    }
});
viridanti commented 8 years ago

Solved. pushNotificationsRegister was being called with the first registration only. However, it's intended to be called each time the app starts.