eclipsesource / eclipsesource/tabris-plugin-firebase

No Notification for Data Message

Open
#62 4 comments 0 reactions 0 assignees View on GitHub
bug ios
Dominant language
JavaScript
Stars
6
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### 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](https://github.com/eclipsesource/tabris-plugin-firebase/blob/master/doc/cloud-messaging.md) 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:
```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:
```bash
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.