Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-notifications
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
冷佳娟
react-native-notifications
Commits
5f228aad
Commit
5f228aad
authored
Jul 09, 2019
by
yogevbd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pushKit docs
parent
6230fdb9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
docs/advancedIos.md
docs/advancedIos.md
+14
-1
No files found.
docs/advancedIos.md
View file @
5f228aad
...
...
@@ -91,11 +91,20 @@ After [preparing your app to receive VoIP push notifications](https://developer.
#import <PushKit/PushKit.h>
```
### Listen to PushKit notifications
On receiving PushKit notification, a
`pushKitNotificationReceived`
event will be fired with the notification payload.
```
objective-c
#import "RNNotifications.h"
#import <PushKit/PushKit.h>
```
In your ReactNative code, add event handler for
`pushKitRegistered`
event and call to
`registerPushKit()`
:
```
javascript
constructor
()
{
NotificationsIOS
.
addEventListener
(
'
pushKitRegistered
'
,
this
.
onPushKitRegistered
.
bind
(
this
));
NotificationsIOS
.
addEventListener
(
'
pushKitNotificationReceived
'
,
this
.
onPushKitNotificationReceived
.
bind
(
this
));
NotificationsIOS
.
registerPushKit
();
}
...
...
@@ -103,6 +112,10 @@ onPushKitRegistered(deviceToken) {
console
.
log
(
"
PushKit Token Received:
"
+
deviceToken
);
}
onPushKitNotificationReceived
(
notification
)
{
console
.
log
(
'
PushKit notification Received:
'
+
JSON
.
stringify
(
notification
));
}
componentWillUnmount
()
{
// Don't forget to remove the event listeners to prevent memory leaks!
NotificationsIOS
.
removeEventListener
(
'
pushKitRegistered
'
,
onPushKitRegistered
(
this
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment