I have a standard implementation of listening to event and show a popup with notification contents.

Expected behavior: When app is in foreground, listen to event and show a popup with notification contents.

Observation on Android: 1. When app is in foreground, there is no popup (as a result of event doesn’t fire). Notification shows in notification area. 2. Notification when clicked triggers event and I see a popup. This is true for any notification that shows even when app is in background.

Observation on iOS: 1. When app is in foreground, I see the popup. Notification doesn’t shows in notification area. This is expected and good.

Code sample:

document.addEventListener('push-notification', () => {
let content;
  if (Platform.isIOS()) {
    content = event.notification && event.notification.aps && event.notification.aps.alert;
alert(content);
  } else if (Platform.isAndroid()) {
    content = event.notification && event.notification.title;
alert(content);
  }
});
asked 29 Feb '16, 13:52
crashuniverse's gravatar image

crashuniverse
112

edited 29 Feb '16, 13:57

Hi!

Could you please tell me whether you've added the PW_BROADCAST_PUSH metadata in your Manifest file?

permanent link
answered 01 Mar '16, 06:57
Nikolai's gravatar image

Nikolai
3585

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
×446
×14
×13

question asked: 29 Feb '16, 13:52

question was seen: 718 times

last updated: 01 Mar '16, 06:57