Reputation: 44600
I don't receive GCM push notifications for my Android app when app is closed. However if I send notification and my app is open, the message gets delivered instantly.
The format that I use for GCM:
{
to: 'deviceToken'
priority: 'high',
data: {
id: notification.id,
message: notification.message,
path: notification.path
}
}
I am sending silent notifications, I aware that I don't have "notification" field. When I receive silent notification, I send visible local notification. I receive notifications when I debug or when app is running, so there is no reason to think that this workflow doesn't work.
It's a React Native app, I used https://github.com/zo0r/react-native-push-notification for push notifications.
Upvotes: 0
Views: 334
Reputation: 44600
It turned out, I just needed to remove id
from data payload and it started working as expected. Maybe it's something internal with the library that I am using or google doesn't like it, not sure.
{
to: 'deviceToken'
priority: 'high',
data: {
message: notification.message,
path: notification.path
}
}
Upvotes: 1