Skip to content

No Notification for Data Message #62

Description

@raphaelpreston

Problem description

When I send a 'data' message, no notification is shown if the app isn't open. I took a look at #9, but I'm fairly certain I'm composing the message correctly.

Expected behavior

The documentation states that a 'data' message is "a notification that also delivers its data to the app", so, I would expect a notification to appear.

Environment

  • Tabris.js version: 3.0.0-beta1
  • Device: iPhone 7
  • OS: iOS 11.1.1

Code snippet

In-app Javascript:
/* check to see if app was launched by notification tap */
setTimeout(() => { // workaround for #41
  console.log('launchData after timeout: ', firebase.Messaging.launchData);
});

/* handle any messages that arrive */
firebase.Messaging.on('message', ({data}) => {
	console.warn('Received message data: ', data)
});
Command Line Notification Composition:
curl -X POST -H "Authorization: key=$key" -H "Content-Type: application/json" -d "{
    \"to\": \"$token\",
    \"data\": {
	  \"title\": \"Title\",
	  \"body\": \"Body\",
      \"payload\": \"custom data\"
    }
  }
" https://fcm.googleapis.com/fcm/send
# Response in terminal: {..."success":1,"failure":0,...}

If the app is open, then the following prints:
Received message data: {payload: 'custom data', title: 'Title', body: 'Body',...}

But if the app is closed, then nothing prints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions