【问题标题】:Permissions in Firebase notificationsFirebase 通知中的权限
【发布时间】:2020-04-10 09:31:00
【问题描述】:

我在与 Firebase 实时数据库相关的 Google Cloud Platform 中创建了这个函数。当数据库中出现某些内容时,该函数会向移动应用程序发送通知。

如下所示,我设置了优先级,以便用户注意到通知

var message = {
    token: tokenSnapshot,
    notification: {
        title: "Title",
        body: "Body",
    },
    android: {
        priority: 'high',
        notification: {
            sound: 'default',
            priority: 'high',
            visibility: 'public'
        }
    },
};

不幸的是,它什么也没做。通知来了,但用户在手动检查是否有东西时会看到

我在应用程序中使用标准方法

messaging().enable.setBackgroundMessageHandler(async remoteMessage => {
    console.log('Message handled in the background!', JSON.stringify(remoteMessage));
  })

有什么方法可以让通知带有声音、振动并出现在锁定屏幕上?

我还没有使用过react-native-push-notification 库。这个库可以在这方面提供帮助吗?

【问题讨论】:

    标签: firebase react-native push-notification firebase-cloud-messaging


    【解决方案1】:

    如果您使用的是 firebase-cloud 消息传递,我建议在您的应用中使用 firebase。 https://rnfirebase.io/messaging/usage

    确保您首先遵循初始设置。

    请在此处阅读有关此内容的更多信息。 https://rnfirebase.io/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-10
      • 2018-09-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-19
      • 2021-11-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多