Skip to content

Commit 836366a

Browse files
committed
update docs
1 parent 854f5a9 commit 836366a

File tree

3 files changed

+64
-69
lines changed

3 files changed

+64
-69
lines changed

example/documents/APIs.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- [Common API](#common-api)
44
- [getRegistrationID](#getregistrationid)
5+
- [stopPush](#stoppush)
56
- [setAlias](#setalias)
67
- [addTags](#addtags)
78
- [setTags](#settags)
@@ -11,6 +12,8 @@
1112
- [Receive Notification event](#receive-notification-event)
1213
- [Receive Custom Message Event](#receive-custom-message-event)
1314
- [sendLocalNotification](#sendlocalnotification)
15+
- [clearAllNotifications](#clearallnotifications)
16+
- [clearNotificationById](#clearnotificationbyId)
1417
- [iOS Only API](#ios-only-api)
1518
- [setBadge](#setbadge)
1619
- [getBadge](#getbadge)
@@ -19,13 +22,10 @@
1922
- [Network Did Login Event](#network-did-login-event)
2023
- [Android Only API](#android-only-api)
2124
- [initPush](#initpush)
22-
- [stopPush](#stoppush)
2325
- [resumePush](#resumepush)
2426
- [crashLogOFF](#crashlogoff)
2527
- [crashLogON](#crashlogon)
2628
- [notifyJSDidLoad](#notifyjsdidload)
27-
- [clearAllNotifications](#clearallnotifications)
28-
- [clearNotificationById](#clearnotificationbyId)
2929
- [getInfo](#getInfo)
3030
- [setStyleBasic](#setstylebasic)
3131
- [setStyleCustom](#setstylecustom)
@@ -50,6 +50,15 @@ registrationId generated by JPush SDK according to deviceToken .
5050
JPushModule.getRegistrationID((registrationId) => {})
5151
```
5252

53+
54+
#### stopPush
55+
56+
Stop push.
57+
58+
```
59+
JPushModule.stopPush();
60+
```
61+
5362
#### setAlias
5463

5564
set device's application alias, you can push notificaiton with alias, every device can only have one alias.
@@ -102,9 +111,9 @@ reset tags.
102111
- sendLocalNotification(notification)
103112

104113
- **buildId** : Number // set local notification styles,1 defoult style,2 custom style( you should call setStyleCustom frist) (Android Only)
105-
- **id** : Number // local notification identify,l you can use it to cancel local notification
106-
- **title** : String // local notification title
107-
- **content** : String // local notification content
114+
- **id** : Number // local notification identify,l you can use it to cancel local notification
115+
- **title** : String // local notification title
116+
- **content** : String // local notification content
108117
- **extra** : Object // local notification extra (key-value)
109118
- **fireTime** : Number // show local notification time(ms)
110119
- **badge** : Number // when local notification fire, application icon will set badge with this value (iOS Only)
@@ -127,6 +136,24 @@ reset tags.
127136
)
128137
```
129138

139+
140+
#### clearAllNotifications
141+
142+
Clear all notifications.
143+
144+
```
145+
JPushModule.clearAllNotifications();
146+
```
147+
148+
#### clearNotificationById
149+
150+
Clear notification by id(int type).
151+
152+
```
153+
var id = 5;
154+
JPushModule.clearNotificationById(id);
155+
```
156+
130157
#### Open Notification Event
131158

132159
**NOTE**: iOS need update to [email protected]+
@@ -185,8 +212,6 @@ reset tags.
185212
```
186213

187214

188-
189-
190215
### iOS Only API
191216

192217
All apis can find in jpush-react-native/index.js.
@@ -282,14 +307,6 @@ setLocalNotification( Date, // date local notification fire data
282307
JPushInterface.init(this);
283308
```
284309

285-
- #### stopPush
286-
287-
Stop push. Suggest invokes in `MainActivity` 's `onStop` method:
288-
289-
```
290-
JPushInterface.onStop(this);
291-
```
292-
293310
- #### resumePush
294311

295312
Resume push. Suggest invokes in `MainActivity` 's `onResume` method:
@@ -324,23 +341,6 @@ setLocalNotification( Date, // date local notification fire data
324341
});
325342
```
326343

327-
- #### clearAllNotifications
328-
329-
Clear all notifications.
330-
331-
```
332-
JPushModule.clearAllNotifications();
333-
```
334-
335-
- #### clearNotificationById
336-
337-
Clear notification by id(int type).
338-
339-
```
340-
var id = 5;
341-
JPushModule.clearNotificationById(id);
342-
```
343-
344344
- #### getInfo
345345

346346
Get device's infomation.

example/documents/APIs_zh.md

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
- [Common API](#common-api)
44
- [getRegistrationID](#getregistrationid)
5+
- [stopPush](#stoppush)
56
- [setAlias](#setalias)
67
- [addTags](#addtags)
78
- [deleteTags](#deletetags)
89
- [setTags](#settags)
910
- [cleanTags](#cleantags)
1011
- [sendLocalNotification](#sendlocalnotification)
12+
- [clearAllNotifications](#clearallnotifications)
13+
- [clearNotificationById](#clearnotificationbyId)
1114
- [点击推送事件](#点击推送事件)
1215
- [接收推送事件](#接收推送事件)
1316
- [接收自定义消息事件](#接收自定义消息事件)
@@ -20,13 +23,10 @@
2023
- [网络成功登陆事件](#network-did-login-event)
2124
- [Android Only API](#android-only-api)
2225
- [initPush](#initpush)
23-
- [stopPush](#stoppush)
2426
- [resumePush](#resumepush)
2527
- [crashLogOFF](#crashlogoff)
2628
- [crashLogON](#crashlogno)
2729
- [notifyJSDidLoad](#notifyjsdidload)
28-
- [clearAllNotifications](#clearallnotifications)
29-
- [clearNotificationById](#clearnotificationbyId)
3030
- [getInfo](#getInfo)
3131
- [setStyleBasic](#setstylebasic)
3232
- [setStyleCustom](#setstylecustom)
@@ -52,6 +52,15 @@ Android 和 iOS 通用 API。
5252
JPushModule.getRegistrationID((registrationId) => {})
5353
```
5454

55+
56+
#### stopPush
57+
58+
停止推送。
59+
60+
```
61+
JPushModule.stopPush();
62+
```
63+
5564
#### setAlias
5665

5766
- setAlias(alias, successCallback)
@@ -134,15 +143,9 @@ Android 和 iOS 通用 API。
134143
- sendLocalNotification(notification)
135144

136145
- **buildId** : Number // 设置通知样式,1 为基础样式,2 为自定义样式。自定义样式需要先调用 setStyleCustom 接口设置自定义样式。(Android Only)
137-
<<<<<<< HEAD
138-
- **id** : Number // 通知的 id, 可用于取消通知
139-
- **title** : String // 通知标题
140-
- **content** : String // 通知内容
141-
=======
142-
- **id** : Number // 通知的 id, 可用于取消通知
146+
- **id** : Number // 通知的 id, 可用于取消通知
143147
- **title** : String // 通知标题
144148
- **content** : String // 通知内容
145-
>>>>>>> 57b24382bb295d08dbb0f1275ebfc3880fe2d9b9
146149
- **extra** : Object // extra 字段
147150
- **fireTime** : Number // 通知触发时间的时间戳(毫秒)
148151
- **badge** : Number // 本地推送触发后应用角标的 badge 值 (iOS Only)
@@ -165,6 +168,23 @@ Android 和 iOS 通用 API。
165168
)
166169
```
167170

171+
#### clearAllNotifications
172+
173+
清除所有通知
174+
175+
```
176+
JPushModule.clearAllNotifications();
177+
```
178+
179+
#### clearNotificationById
180+
181+
根据 notificationId 来清除通知, notificationId 为 int 类型。
182+
183+
```
184+
var notificationId = 5;
185+
JPushModule.clearNotificationById(id);
186+
```
187+
168188
#### 点击推送事件
169189

170190
**NOTE**: iOS 需要安装到 [email protected]+ 。
@@ -329,14 +349,6 @@ setLocalNotification( Date, // date 触发本地推送的时间
329349
JPushInterface.init(this);
330350
```
331351

332-
- #### stopPush
333-
334-
停止推送。建议在 `MainActivity``onStop` 中调用:
335-
336-
```
337-
JPushInterface.onStop(this);
338-
```
339-
340352
- #### resumePush
341353

342354
恢复推送。建议在 `MainActivity``onResume` 中调用:
@@ -371,23 +383,6 @@ setLocalNotification( Date, // date 触发本地推送的时间
371383
});
372384
```
373385

374-
- #### clearAllNotifications
375-
376-
清除所有通知
377-
378-
```
379-
JPushModule.clearAllNotifications();
380-
```
381-
382-
- #### clearNotificationById
383-
384-
根据 notificationId 来清除通知, notificationId 为 int 类型。
385-
386-
```
387-
var notificationId = 5;
388-
JPushModule.clearNotificationById(id);
389-
```
390-
391386
- #### getInfo
392387

393388
获取设备信息

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jpush-react-native",
3-
"version": "2.1.5",
3+
"version": "2.1.6",
44
"description": "a jpush plugin for react native application",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)