|
26 | 26 | <dependency> |
27 | 27 | <groupId>cn.jpush.api</groupId> |
28 | 28 | <artifactId>jpush-client</artifactId> |
29 | | - <version>3.2.7</version> |
| 29 | + <version>3.2.8</version> |
30 | 30 | </dependency> |
31 | 31 | ``` |
32 | 32 | ### jar 包方式 |
|
200 | 200 | } |
201 | 201 | ``` |
202 | 202 |
|
| 203 | +* 构建推送对象:推送内容包含SMS信息 |
| 204 | + |
| 205 | +```Java |
| 206 | + public static void testSendWithSMS() { |
| 207 | + JPushClient jpushClient = new JPushClient(masterSecret, appKey); |
| 208 | + try { |
| 209 | + SMS sms = SMS.content("Test SMS", 10); |
| 210 | + PushResult result = jpushClient.sendAndroidMessageWithAlias("Test SMS", "test sms", sms, "alias1"); |
| 211 | + LOG.info("Got result - " + result); |
| 212 | + } catch (APIConnectionException e) { |
| 213 | + LOG.error("Connection error. Should retry later. ", e); |
| 214 | + } catch (APIRequestException e) { |
| 215 | + LOG.error("Error response from JPush server. Should review and fix it. ", e); |
| 216 | + LOG.info("HTTP Status: " + e.getStatus()); |
| 217 | + LOG.info("Error Code: " + e.getErrorCode()); |
| 218 | + LOG.info("Error Message: " + e.getErrorMessage()); |
| 219 | + } |
| 220 | + } |
| 221 | +``` |
| 222 | + |
203 | 223 | ### 统计获取样例 |
204 | 224 |
|
205 | 225 | > 以下片断来自项目代码里的文件:example / cn.jpush.api.examples.ReportsExample |
|
227 | 247 |
|
228 | 248 | > 以下片断来自项目代码里的文件:example / cn.jpush.api.examples.DeviceExample |
229 | 249 |
|
| 250 | +* 获取Tag Alias |
230 | 251 | ```Java |
231 | 252 | try { |
232 | 253 | TagAliasResult result = jpushClient.getDeviceTagAlias(REGISTRATION_ID1); |
|
243 | 264 | } |
244 | 265 | ``` |
245 | 266 |
|
| 267 | +* 绑定手机号 |
| 268 | + |
| 269 | +```Java |
| 270 | + try { |
| 271 | + DefaultResult result = jpushClient.bindMobile(REGISTRATION_ID1, "13000000000"); |
| 272 | + LOG.info("Got result " + result); |
| 273 | + } catch (APIConnectionException e) { |
| 274 | + LOG.error("Connection error. Should retry later. ", e); |
| 275 | + } catch (APIRequestException e) { |
| 276 | + LOG.error("Error response from JPush server. Should review and fix it. ", e); |
| 277 | + LOG.info("HTTP Status: " + e.getStatus()); |
| 278 | + LOG.info("Error Code: " + e.getErrorCode()); |
| 279 | + LOG.info("Error Message: " + e.getErrorMessage()); |
| 280 | + } |
| 281 | +``` |
| 282 | + |
246 | 283 | ### Schedule 样例 |
247 | 284 |
|
248 | 285 | > 以下片断来自项目代码里的文件:example / cn.jpush.api.examples.ScheduleExample |
|
0 commit comments