小编fla*_*ack的帖子

Flutter FCM 图像未显示在通知中

有关如何在推送通知中显示我在 firebase 控制台中记录的图像的任何提示?它们正在工作,但是当我发送图像时,它不会出现在通知中。我正在使用 firebase_message 和 flutter_local_notifications。

当我发送通知时,它会出现,但图像不会出现。请记住,我将 URl 放入 firebaseConsole 中创建通知的图像中

Firebase配置:

class FireBaseNotifications {
  final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
  final LocalNotifications _localNotifications;

  FireBaseNotifications._internal(this._localNotifications);
  static final FireBaseNotifications _singleton =
      FireBaseNotifications._internal(LocalNotifications());
  factory FireBaseNotifications() => _singleton;

  Future<void> initializeFirebasePushServices() async {
    await FirebaseMessaging.instance
        .setForegroundNotificationPresentationOptions(
            badge: true, sound: true, alert: true);

    FirebaseMessaging.onMessage.listen(
      (push) {
        RemoteNotification? notification = push.notification;
        AndroidNotification? androidNotification = push.notification?.android;
        AppleNotification? iosNotification = push.notification?.apple;

        if (notification != null && androidNotification != null) {
          _localNotifications.androidNotifications(
            notification: notification,
            androidNotification: androidNotification,
          );
        }
        if (notification …
Run Code Online (Sandbox Code Playgroud)

push-notification firebase flutter firebase-cloud-messaging

5
推荐指数
1
解决办法
2083
查看次数