firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.6k stars 358 forks source link

Content available value is allways false #1607

Closed ghost closed 2 years ago

ghost commented 2 years ago

Describe your environment

Describe the problem

Steps to reproduce:

I am using firebase admin messaging to send notifications and I pass content contentAvailable: true value like this:

import { Messaging } from 'firebase-admin/lib/messaging/messaging'
await this.fcm.sendToDevice(tokens, message, {
                        contentAvailable: true,
                        priority: 'high',
})

message has notification with body and title both not empty and a data object, but in flutter application (I use firebase_messaging: "^11.1.0" library) I receive a message on background with parameter contentAvailable:false. Problem is that I receive notification locally on android and ios they work, I get data and so on, but in production I have problem iOS is not sending it sometimes, I changed this value and priority to solve the issue but it did not work, so I checked and say that contentAvailable is false, while I send it as true.

import 'package:firebase_messaging/firebase_messaging.dart';
FirebaseMessaging.onBackgroundMessage(backgroundHandler);
Future<void> backgroundHandler(RemoteMessage remoteMessage) async {
// remoteMessage content available is false here...
  final s = ShowNotificationHandler();
  await s.showNotification(remoteMessage);
}

Any idea what is wrong? It's easily reproducible.

chong-shao commented 2 years ago

Hello @albertbolush Thanks for reporting the issue. To help better debugging the issue I'd recommend file a support issue in https://firebase.google.com/support and from there you can provide information including more sample code and your identifiers. Thanks!