android - 使用 channel ID 时,世博会通知不起作用

标签 android react-native expo expo-notifications

我正在使用以下代码在 Android 上为我的 expo react 应用程序创建两个 channel :

Notifications.setNotificationChannelAsync("default", {
            name: "default",
            importance: Notifications.AndroidImportance.MAX,
            vibrationPattern: [0, 250, 250, 250],
            lightColor: "#FF231F7C",
        })  

Notifications.setNotificationChannelAsync("gameupdates", {
                name: "gameupdates",
                importance: Notifications.AndroidImportance.MAX,
                vibrationPattern: [0, 250, 250, 250],
                lightColor: "#FF231F7C",
            })
该 channel 已成功创建,我什至可以在进入 Expo 应用程序通知选项时找到它。
当我使用 expo's tool 发送通知时没有任何 channel ID,它工作正常。但是,当我使用 channel ID“gameupdates”时,通知永远不会到达我的手机。
知道为什么吗?
我在世博 SDK 38 上。

最佳答案

解决它!问题是我需要添加 android.useNextNotificationsApi: true到 app.json。
然后我不得不做expo:build手动 上传构建。

关于android - 使用 channel ID 时,世博会通知不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63338534/

相关文章:

react-native - Expo EAS 环境变量和 secret 值在构建期间未完全识别

Android:无法在主线程上执行网络操作

javascript - react native Stripe 支付网关

android - ScrollView 内的 ScrollView

ios - 如何缩小 React-Native map

javascript - React Native ListView TextInput 锁定性能优化渲染

typescript - 基于 Expo 将华为移动服务集成到 React Native 应用中

android - react 原生 : Android not setting width and height correct []

java - Android BLE发送数据

java - Android - 在 ListView 中显示所有 SQLite 数据库条目