请检查问题问here的更多信息,因为我想实现正是在世博会React Native我试过使用通知包和Notifee包,但似乎找不到添加此功能的方法push notification with custom icons的
93ze6v8z1#
这可以通过Notifee/react-native包来实现,它适用于bare expo和react native expo项目,对于bare expo项目,在安装notifee后,按照他们的文档here,然后通过app.json文件将所需的功能添加到应用程序中,
"ios": { "entitlements": { "com.apple.developer.usernotifications.communication": true }, "infoPlist": { "UIBackgroundModes": ["location", "fetch", "remote-notification"], "NSUserActivityTypes": ["INSendMessageIntent"] }, }
字符串这为ios添加了通信通知功能,还将INSendMessageIntent添加到info.plist中的NSUserActivityTypes然后使用Notifee包显示通知,方法是:
await notifee.displayNotification({ title: "Some title", body: "Notification Body", ios: { foregroundPresentationOptions: { badge: true, sound: true, banner: true, list: true, }, categoryId: 'messageID', communicationInfo: { conversationId: "123", sender: { id: "456", avatar: "Avatar-url", displayName: "John Doe", }, }, } })
型
1条答案
按热度按时间93ze6v8z1#
这可以通过Notifee/react-native包来实现,它适用于bare expo和react native expo项目,对于bare expo项目,在安装notifee后,按照他们的文档here,然后通过app.json文件将所需的功能添加到应用程序中,
字符串
这为ios添加了通信通知功能,还将INSendMessageIntent添加到info.plist中的NSUserActivityTypes
然后使用Notifee包显示通知,方法是:
型