将本机推送通知反应到 运行 收到通知的函数
React native push notifcation to run a function on notification received
是否可以在收到远程通知时在 javascript 中执行 运行 函数(本机反应)?唤醒远程通知会在后台做出本机反应吗?
或者应该 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 中执行 运行 函数(本机反应)?唤醒远程通知会在后台做出本机反应吗?
或者应该 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。