【问题标题】:Is It possible to expand FCM in Flutter?是否可以在 Flutter 中扩展 FCM?
【发布时间】:2020-12-22 10:02:03
【问题描述】:

我想问如果文本已经溢出,是否可以在flutter FCM通知中扩展通知?

这是我用于通知的示例代码:

void initFirebase() {
    _firebaseMessaging = FirebaseMessaging();
    _firebaseMessaging.requestNotificationPermissions(
        const IosNotificationSettings(
            sound: true, badge: true, alert: true, provisional: false));
    _firebaseMessaging.onIosSettingsRegistered
        .listen((IosNotificationSettings settings) {
      debugPrint('Settings registered: $settings');
    });
  }

  void configFirebase() {
    _firebaseMessaging.configure(
      onMessage: (Map<String, dynamic> message) async {
        print(message);
        final FirebaseModel dataModel = FirebaseModel.fromJson(message);
        await notifHandler.showNotif(dataModel);
        notifHandler.onNotifRefresh(dataModel.data?.action);
        if (dataModel?.data?.action == AppString.CONFIRM_REDEEM_POINT) {
          notifHandler.onSelectNotification(dataModel?.data?.action ?? '');
        }
      },
//      onBackgroundMessage: _onBackgroundMessage,
      onResume: _showFirebaseNotif,
      onLaunch: _showFirebaseNotif,
    );
  }

这是我得到的结果

【问题讨论】:

    标签: flutter push-notification notifications firebase-cloud-messaging


    【解决方案1】:

    是的,您可能需要像这样在 AndroidNotificationDetails 中将样式信息作为 BigTextStyleInformation('') 提供

            final androidChannelSpecifics = AndroidNotificationDetails(
              'your channel id',
              'your channel name',
              'your channel description',
              importance: Importance.Max,
              priority: Priority.High,
              ongoing: true,
        
              styleInformation: BigTextStyleInformation(''),
            );
    

    【讨论】:

      猜你喜欢
      • 2018-08-16
      • 1970-01-01
      • 1970-01-01
      • 2021-06-24
      • 2010-12-21
      • 1970-01-01
      • 2012-03-12
      • 1970-01-01
      • 2021-11-23
      相关资源
      最近更新 更多