I'm developing chat notifications for our mobile app in Adobe Air using Pushwoosh. I've managed to integrate Pushwoosh, and have notifications about unread chat messages being sent to device all fine. The problem I have is that the push notification received event is never fired at all.

Notifications are not sent when the user is registered as online in our system (the app is open), only when they are offline (the app is closed or in the background). When they're offline notifications work just fine, and when a user taps on the notification the app opens no problem.

I would like to be able to use the notification received event to display a specific part of the app when the user taps the notification, but can't do that at the moment as the event doesn't fire.

Here is the code I'm using in air relevant to pushwoosh:

var pushwoosh:PushNotification = PushNotification.getInstance();

pushwoosh.addEventListener(PushNotificationEvent.PERMISSION_GIVEN_WITH_TOKEN_EVENT, onToken);
pushwoosh.addEventListener(PushNotificationEvent.PERMISSION_REFUSED_EVENT, onError);                pushwoosh.addEventListener(PushNotificationEvent.PUSH_NOTIFICATION_RECEIVED_EVENT, onPushReceived);

pushwoosh.onDeviceReady();

pushwoosh.registerForPushNotification();

// This works just fine.
private function onToken(e:PushNotificationEvent):void 
{
    trace("\n PUSHWOOSH TOKEN: " + e.token + " "); 
}

// No idea if it works or not. Probably?
private function onError(e:PushNotificationEvent):void 
{ 
    trace("\n PUSHWOOSH ERROR: " + e.errorMessage+ " "); 
}

// Never fired at all.
private function onPushReceived(e:PushNotificationEvent):void
{ 
    trace("\n PUSHWOOSH RECEIVED: " + JSON.stringify(e.parameters) + " "); 
}

I'm using the latest ANE, and have no idea why this isn't working.

asked 28 Aug '14, 03:09
AshCrockett's gravatar image

AshCrockett
214

edited 28 Aug '14, 03:11

I had the same problem, for me I forgot to prefix 'air.' to PACKAGE_NAME in app.xml

eg if the package name is com.example.someapp , then it becomes: air.com.example.someapp

permanent link
answered 28 Oct '14, 17:53
fajar's gravatar image

fajar
161

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:

×446
×445
×15
×14

question asked: 28 Aug '14, 03:09

question was seen: 1,520 times

last updated: 28 Oct '14, 17:53