【发布时间】:2026-02-04 11:40:01
【问题描述】:
错误:WARN 未传递频道 ID,通知可能不起作用。
[LOG] createChannel 返回“假”
如何传递频道ID?
这是我的代码:
export const LocalNotification = () => {
PushNotification.localNotification({
autoCancel: true,
bigText:
'This is local notification demo in React Native app. Only shown, when expanded.',
subText: 'Local Notification Demo',
title: 'Local Notification Title',
message: 'Expand me to see more',
vibrate: true,
vibration: 300,
playSound: true,
soundName: 'default',
actions: '["Yes", "No"]'
})
}
const startFunction = async () => {
PushNotification.createChannel(
{
channelId: "channel-id-1",
channelName: "My channel",
channelDescription: "A channel to categorise your notifications",
playSound: false,
soundName: "default",
importance: Importance.HIGH,
vibrate: true,
},
(created) => console.log(`createChannel returned '${created}'`)
);
LocalNotification();
}
【问题讨论】:
标签: react-native react-native-push-notification