Skip to content

Commit 243d5a0

Browse files
Merge pull request #370 from jpush/dev
udpate docs add sendLocalNotification api
2 parents 7f9032b + 1d929c1 commit 243d5a0

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

example/documents/APIs.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [Open Notification Event](#open-notification-event)
1111
- [Receive Notification event](#receive-notification-event)
1212
- [Receive Custom Message Event](#receive-custom-message-event)
13+
- [sendLocalNotification](#sendlocalnotification)
1314
- [iOS Only API](#ios-only-api)
1415
- [setBadge](#setbadge)
1516
- [getBadge](#getbadge)
@@ -96,6 +97,37 @@ 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

101133
**NOTE**: iOS need update to [email protected]+
@@ -149,7 +181,7 @@ reset tags.
149181

150182
- removeReceiveCustomMsgListener(function)
151183

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

example/documents/APIs_zh.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [deleteTags](#deletetags)
88
- [setTags](#settags)
99
- [cleanTags](#cleantags)
10+
- [sendLocalNotification](#sendlocalnotification)
1011
- [点击推送事件](#点击推送事件)
1112
- [接收推送事件](#接收推送事件)
1213
- [接收自定义消息事件](#接收自定义消息事件)
@@ -127,6 +128,37 @@ 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

132164
**NOTE**: iOS 需要安装到 [email protected]+ 。

0 commit comments

Comments
 (0)