相关疑难解决方法(0)

React Native 推送通知在 Android 中不起作用,但在 iOS 上工作正常

我最近在我的 React Native 应用程序中设置了推送通知,它在 iO 中运行良好,但在 Android 中无法弹出。这是我调用来触发通知的函数。

function pushNotif(){ 
        PushNotification.localNotification({
                channelId: "specialid", // (required) channelId, if the channel doesn't exist, notification will not trigger.
                title: "hello",
                message: "test message"
        })
}
Run Code Online (Sandbox Code Playgroud)

这是我配置上面推送通知的地方

// Must be outside of any component LifeCycle (such as `componentDidMount`).
PushNotification.configure({
   // (optional) Called when Token is generated (iOS and Android)
   onRegister: function (token) {
   console.log("TOKEN:", token);
    },

    // (required) Called when a remote is received or opened, or local notification is opened
    onNotification: function (notification) …
Run Code Online (Sandbox Code Playgroud)

android ios react-native android-push-notification

2
推荐指数
1
解决办法
2万
查看次数