gpt4 book ai didi

javascript - react native 推送通知以在收到通知时运行功能

转载 作者:行者123 更新时间:2023-11-29 00:36:25 25 4
gpt4 key购买 nike

当收到远程通知时,是否可以在 javascript 中运行一个函数(react native)?唤醒远程通知会在后台做出原生 react 吗?

还是应该用 Swift/Objective-C 来完成?

最佳答案

绝对有可能!查看documentation for PushNotificationIOS

componentWillMount() {
PushNotificationIOS.addEventListener('notification', this._onRemoteNotification);
}

_onRemoteNotification(notification) {
// handle the notification
}

您需要 manually link the Library并在您的 AppDelegate.m 文件中添加监听器。

这也假设您已经 configured your APNs with Apple .

关于javascript - react native 推送通知以在收到通知时运行功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40491016/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com