Skip to content

Commit 281b912

Browse files
KenChoiKenChoi
authored andcommitted
Merge branch 'dev' of github.com:jpush/jpush-react-native into dev
2 parents 1bac098 + 1d929c1 commit 281b912

File tree

3 files changed

+141
-79
lines changed

3 files changed

+141
-79
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ dependencies {
7979

8080
### API
8181
**Android v1.6.6 版本后新增 notifiyJSDidLoad,请务必在接收事件之前调用此方法。**
82-
- [Common](https://github.com/jpush/jpush-react-native/blob/master/example/documents/Common.md)
83-
- [Android API](https://github.com/jpush/jpush-react-native/blob/master/example/documents/Android%20API.md)
84-
- [iOS API](https://github.com/jpush/jpush-react-native/blob/master/example/documents/iOS_API.md)
82+
- [API](./example/documents/APIs.md)
8583

8684
### 关于点击通知跳转到指定界面
8785
- Android

example/documents/APIs.md

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
11
[中文文档](./APIs_zh.md)
22

3-
- - [Common API:](#Common API)
4-
- [getRegistrationID](#getRegistrationID)
5-
- [setAlias](#setAlias)
6-
- [addTags](#addTags)
7-
- [setTags](#setTags)
8-
- [cleanTags](#cleanTags)
9-
- [setAlias](#setAlias)
10-
- [Open Notification Event](#Open Notification Event)
11-
- [Receive Notification event](#Receive Notification Event)
12-
- [Receive Custom Message Event](#Receive Custom Message Event)
13-
- [iOS Only API:](#iOS Only API)
14-
- [setBadge](#setBadge)
15-
- [getBadge](#getBadge)
16-
- [setLocalNotification](#setLocalNotification)
17-
- [Open Notification Launch App Event](#Open Notification Launch App Event)
18-
- [Network Did Login Event](#Network Did Login Event)
19-
- [Android Only API:](Android Only API)
20-
- [initPush](#initPush)
21-
- [stopPush](#stopPush)
22-
- [resumePush](#resumePush)
23-
- [crashLogOFF](#crashLogOFF)
24-
- [crashLogON](#crashLogON)
25-
- [notifyJSDidLoad](#notifyJSDidLoad)
26-
- [clearAllNotifications](#clearAllNotifications)
27-
- [clearNotificationById](#clearNotificationById)
3+
- [Common API](#common-api)
4+
- [getRegistrationID](#getregistrationid)
5+
- [setAlias](#setalias)
6+
- [addTags](#addtags)
7+
- [setTags](#settags)
8+
- [cleanTags](#cleantags)
9+
- [setAlias](#setalias)
10+
- [Open Notification Event](#open-notification-event)
11+
- [Receive Notification event](#receive-notification-event)
12+
- [Receive Custom Message Event](#receive-custom-message-event)
13+
- [sendLocalNotification](#sendlocalnotification)
14+
- [iOS Only API](#ios-only-api)
15+
- [setBadge](#setbadge)
16+
- [getBadge](#getbadge)
17+
- [setLocalNotification](#setlocalnotification)
18+
- [Open Notification Launch App Event](#open-notification-launch-app-event)
19+
- [Network Did Login Event](#network-did-login-event)
20+
- [Android Only API](#android-only-api)
21+
- [initPush](#initpush)
22+
- [stopPush](#stoppush)
23+
- [resumePush](#resumepush)
24+
- [crashLogOFF](#crashlogoff)
25+
- [crashLogON](#crashlogon)
26+
- [notifyJSDidLoad](#notifyjsdidload)
27+
- [clearAllNotifications](#clearallnotifications)
28+
- [clearNotificationById](#clearnotificationbyId)
2829
- [getInfo](#getInfo)
29-
- [setStyleBasic](#setStyleBasic)
30-
- [setStyleCustom](#setStyleCustom)
31-
- [setLatestNotificationNumber](#setLatestNotificationNumber)
32-
- [setSilenceTime](#setSilenceTime)
33-
- [setPushTime](#setPushTime)
34-
- [addGetRegistrationIdListener](#addGetRegistrationIdListener)
35-
- [removeGetRegistrationIdListener](#removeGetRegistrationIdListener)
30+
- [setStyleBasic](#setstylebasic)
31+
- [setStyleCustom](#setstylecustom)
32+
- [setLatestNotificationNumber](#setlatestnotificationnumber)
33+
- [setSilenceTime](#setsilencetime)
34+
- [setPushTime](#setpushtime)
35+
- [addGetRegistrationIdListener](#addgetregistrationidlistener)
36+
- [removeGetRegistrationIdListener](#removegetregistrationidlistener)
3637

37-
Note: In Android, you must call initPush first, iOS doesn't need.
38+
**Note**: In Android, you must call initPush first, iOS doesn't need.
3839

3940
### Common API
4041

@@ -96,9 +97,40 @@ reset tags.
9697
JPushModule.cleanTags((success) => {})
9798
```
9899

100+
#### sendLocalNotification
101+
102+
- sendLocalNotification(notification)
103+
104+
- **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
108+
- **extra** : Object // local notification extra (key-value)
109+
- **fireTime** : Number // show local notification time(ms)
110+
- **badge** : Number // when local notification fire, application icon will set badge with this value (iOS Only)
111+
- **soundName** : String // if you what to custom notification sound ,you should specify audio file name (iOS Only)
112+
- **subtitle** : String // set local notification subtitle (iOS10+ Only)
113+
114+
```javascript
115+
var currentDate = new Date()
116+
JPushModule.sendLocalNotification(
117+
{
118+
id:5,
119+
title:'haha',
120+
content:'content',
121+
extra:{key1:'value1',key2:'value2'},
122+
fireTime: currentDate.getTime() + 3000,
123+
badge: 8,
124+
sound: 'fasdfa',
125+
subtitle: "subtitle",
126+
title: 'title'
127+
}
128+
)
129+
```
130+
99131
#### Open Notification Event
100132

101-
**NOTE: ** iOS need update to [email protected]+
133+
**NOTE**: iOS need update to [email protected]+
102134

103135
- addReceiveOpenNotificationListener(function)
104136

@@ -114,7 +146,7 @@ reset tags.
114146
```
115147

116148
#### Receive Notification Event
117-
**NOTE: ** iOS need update to [email protected]+
149+
**NOTE**: iOS need update to [email protected]+
118150

119151
- addReceiveNotificationListener(function)
120152

@@ -135,7 +167,7 @@ reset tags.
135167

136168
#### Receive Custom Message Event
137169
**receive custom message**(Add this listener to receive custom message.)
138-
**NOTE: ** iOS need update to [email protected]+
170+
**NOTE**: iOS need update to [email protected]+
139171
- addReceiveCustomMsgListener(function)
140172

141173
```javascript
@@ -149,7 +181,7 @@ reset tags.
149181

150182
- removeReceiveCustomMsgListener(function)
151183

152-
```
184+
```javascript
153185
JPushModule.removeReceiveCustomMsgListener(callback);
154186
```
155187

@@ -205,7 +237,7 @@ setLocalNotification( Date, // date local notification fire data
205237

206238
#### Open Notification Launch App Event
207239

208-
**NOTE: ** iOS need update to [email protected]+
240+
**NOTE**: iOS need update to [email protected]+
209241

210242
- addOpenNotificationLaunchAppListener(function)
211243

@@ -228,7 +260,7 @@ setLocalNotification( Date, // date local notification fire data
228260

229261
**Network Did Login Event**
230262

231-
**NOTE: ** iOS need update to [email protected]+
263+
**NOTE**: iOS need update to [email protected]+
232264

233265
- addnetworkDidLoginListener(function)
234266

example/documents/APIs_zh.md

Lines changed: 69 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
[English document](./APIs.md)
22

3-
- - [Common API:](#Common API)
4-
- [getRegistrationID](#getRegistrationID)
5-
- [setAlias](#setAlias)
6-
- [addTags](#addTags)
7-
- [deleteTags](#deleteTags)
8-
- [setTags](#setTags)
9-
- [cleanTags](#cleanTags)
3+
- [Common API](#common-api)
4+
- [getRegistrationID](#getregistrationid)
5+
- [setAlias](#setalias)
6+
- [addTags](#addtags)
7+
- [deleteTags](#deletetags)
8+
- [setTags](#settags)
9+
- [cleanTags](#cleantags)
10+
- [sendLocalNotification](#sendlocalnotification)
1011
- [点击推送事件](#点击推送事件)
1112
- [接收推送事件](#接收推送事件)
1213
- [接收自定义消息事件](#接收自定义消息事件)
13-
- [iOS Only API:](#iOS Only API)
14-
- [setBadge](#setBadge)
15-
- [getBadge](#getBadge)
16-
- [setLocalNotification](#setLocalNotification)
17-
- [点击推送启动应用事件](#Open Notification Launch App Event)
18-
- [网络成功登陆事件](#Network Did Login Event)
19-
- [Android Only API:](Android Only API)
20-
- [initPush](#initPush)
21-
- [stopPush](#stopPush)
22-
- [resumePush](#resumePush)
23-
- [crashLogOFF](#crashLogOFF)
24-
- [crashLogON](#crashLogON)
25-
- [notifyJSDidLoad](#notifyJSDidLoad)
26-
- [clearAllNotifications](#clearAllNotifications)
27-
- [clearNotificationById](#clearNotificationById)
14+
- [iOS Only API](#ios-only-api)
15+
- [setBadge](#setbadge)
16+
- [getBadge](#getbadge)
17+
- [setLocalNotification](#setlocalnotification)
18+
- [点击推送启动应用事件](#open-notification-launch-app-event)
19+
- [网络成功登陆事件](#network-did-login-event)
20+
- [Android Only API](#android-only-api)
21+
- [initPush](#initpush)
22+
- [stopPush](#stoppush)
23+
- [resumePush](#resumepush)
24+
- [crashLogOFF](#crashlogoff)
25+
- [crashLogON](#crashlogno)
26+
- [notifyJSDidLoad](#notifyjsdidload)
27+
- [clearAllNotifications](#clearallnotifications)
28+
- [clearNotificationById](#clearnotificationbyId)
2829
- [getInfo](#getInfo)
29-
- [setStyleBasic](#setStyleBasic)
30-
- [setStyleCustom](#setStyleCustom)
31-
- [setLatestNotificationNumber](#setLatestNotificationNumber)
32-
- [setSilenceTime](#setSilenceTime)
33-
- [setPushTime](#setPushTime)
34-
- [addGetRegistrationIdListener](#addGetRegistrationIdListener)
35-
- [removeGetRegistrationIdListener](#removeGetRegistrationIdListener)
30+
- [setStyleBasic](#setstylebasic)
31+
- [setStyleCustom](#setstylecustom)
32+
- [setLatestNotificationNumber](#setlatestnotificationnumber)
33+
- [setSilenceTime](#setsilencetime)
34+
- [setPushTime](#setpushtime)
35+
- [addGetRegistrationIdListener](#addgetregistrationIdlistener)
36+
- [removeGetRegistrationIdListener](#removegetregistrationidlistener)
3637

3738
注意: 在 Android 需要先调用 `initPush` 方法, iOS 端不需要。
3839

@@ -67,7 +68,7 @@ Android 和 iOS 通用 API。
6768

6869
#### addTags
6970

70-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
71+
**NOTE**: iOS 需要安装到 [email protected]+ 。
7172

7273
在原有 tags 的基础上添加 tags。
7374

@@ -85,7 +86,7 @@ Android 和 iOS 通用 API。
8586

8687
#### deleteTags
8788

88-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
89+
**NOTE**: iOS 需要安装到 [email protected]+ 。
8990

9091
删除指定的 tags
9192

@@ -103,7 +104,7 @@ Android 和 iOS 通用 API。
103104

104105
#### cleanTags
105106

106-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
107+
**NOTE**: iOS 需要安装到 [email protected]+ 。
107108

108109
清除所有 tags
109110

@@ -127,9 +128,40 @@ Android 和 iOS 通用 API。
127128
JPushModule.setTags(['tag1','tag2'], (success) => {})
128129
```
129130

131+
#### sendLocalNotification
132+
133+
- sendLocalNotification(notification)
134+
135+
- **buildId** : Number // 设置通知样式,1 为基础样式,2 为自定义样式。自定义样式需要先调用 setStyleCustom 接口设置自定义样式。(Android Only)
136+
- **id** : Number // 通知的 id, 可用于取消通知
137+
- **title** : String // 通知标题
138+
- **content** : String // 通知内容
139+
- **extra** : Object // extra 字段
140+
- **fireTime** : Number // 通知触发时间的时间戳(毫秒)
141+
- **badge** : Number // 本地推送触发后应用角标的 badge 值 (iOS Only)
142+
- **soundName** : String // 指定推送的音频文件 (iOS Only)
143+
- **subtitle** : String // 子标题 (iOS10+ Only)
144+
145+
```javascript
146+
var currentDate = new Date()
147+
JPushModule.sendLocalNotification(
148+
{
149+
id:5,
150+
title:'haha',
151+
content:'content',
152+
extra:{key1:'value1',key2:'value2'},
153+
fireTime: currentDate.getTime() + 3000,
154+
badge: 8,
155+
sound: 'fasdfa',
156+
subtitle: "subtitle",
157+
title: 'title'
158+
}
159+
)
160+
```
161+
130162
#### 点击推送事件
131163

132-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
164+
**NOTE**: iOS 需要安装到 [email protected]+ 。
133165

134166
- addReceiveOpenNotificationListener(function)
135167

@@ -147,7 +179,7 @@ Android 和 iOS 通用 API。
147179

148180
#### 接收推送事件
149181

150-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
182+
**NOTE**: iOS 需要安装到 [email protected]+ 。
151183

152184
- addReceiveNotificationListener(function)
153185

@@ -166,7 +198,7 @@ Android 和 iOS 通用 API。
166198

167199
#### 接收自定义消息事件
168200

169-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
201+
**NOTE**: iOS 需要安装到 [email protected]+ 。
170202

171203
- addReceiveCustomMsgListener(function)
172204

@@ -234,7 +266,7 @@ setLocalNotification( Date, // date 触发本地推送的时间
234266

235267
#### 点击推送启动应用事件
236268

237-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
269+
**NOTE**: iOS 需要安装到 [email protected]+ 。
238270

239271
- addOpenNotificationLaunchAppListener(function)
240272

@@ -257,7 +289,7 @@ setLocalNotification( Date, // date 触发本地推送的时间
257289

258290
**Network Did Login Event**
259291

260-
**NOTE: ** iOS 需要安装到 [email protected]+ 。
292+
**NOTE**: iOS 需要安装到 [email protected]+ 。
261293

262294
- addnetworkDidLoginListener(function)
263295

0 commit comments

Comments
 (0)