![](/img/trans.png)
[英]IOS push notifications not working on react native using firebase and react-native-push-notifications
[英]How to create Firebase push notifications group in React Native?
使用本機推送通知
// 創建通道
import PushNotification, {Importance} from 'react-native-push-notification';
...
PushNotification.createChannel(
{
channelId: "channel-id", // (required)
channelName: "My channel", // (required)
channelDescription: "A channel to categorise your notifications", // (optional) default: undefined.
playSound: false, // (optional) default: true
soundName: "default", // (optional) See `soundName` parameter of `localNotification` function
importance: Importance.HIGH, // (optional) default: Importance.HIGH. Int value of the Android notification importance
vibrate: true, // (optional) default: true. Creates the default vibration pattern if true.
},
(created) => console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed.
);
// 這會顯示每個新通知一段時間,然后將其推送到組中
PushNotification.localNotification({
channelId: 'channel-id',
title: `New message`,
message: 'Hello world',
})
// 這組消息
PushNotification.localNotification({
channelId: 'channel-id',
id: 'messages',
group: 'messages',
groupSummary: true
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.