我最近在我的 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)