创建通知通道本机反应

时间:2020-10-26 18:13:48

标签: android react-native push-notification

我正在使用 react-native-firebase v6 处理推送通知。 由于此版本没有没有创建频道ID 功能,在React Native项目中创建频道ID的解决方案是什么?

1 个答案:

答案 0 :(得分:0)

您可以使用此库https://github.com/zo0r/react-native-push-notification 然后

      PushNotification.createChannel(
    {
      channelId: "channel-id", // (required)
      channelName: "My channel", // (required)
      channelDescription: "A channel to categorise your notifications", // (optional) default: undefined.
      soundName: "default", // (optional) See `soundName` parameter of `localNotification` function
      importance: 4, // (optional) default: 4. Int value of the Android notification importance
      vibrate: true, // (optional) default: true. Creates the default vibration patten if true.
    },
    (created) => console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed.
  );