1、引入Maven
<!--极光短信包-->
<!-- https://mvnrepository.com/artifact/cn.jpush.api/jiguang-common -->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jiguang-common</artifactId>
<version>1.2.0</version>
</dependency>
<!--极光短信包-->
<!-- https://mvnrepository.com/artifact/cn.jpush.api/jsms-client -->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jsms-client</artifactId>
<version>1.2.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.jpush.api/jpush-client -->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.6.3</version>
</dependency>
2、 极光推送接口测试
@Test
public void sendMsg() {
//https://www.jiguang.cn/portal/#/dev/sdkIntegration/a1ffab96b1224587b3f2947c/android
final String phoneNumber = "1871637xxxx";
//46f7f8c30a3b10f85a6a62f7bb53f29b
//发送短信
SMSClient client = new SMSClient(SmsConfig.masterSecret, SmsConfig.apikey);
//46f7f8c30a3b10f85a6a62f7bb53f29b
SMSPayload payload = SMSPayload.newBuilder()//
.setSignId(SmsConfig.singId)//
.setMobileNumber(phoneNumber).setTempId(SmsConfig.tempId)//对第3方系统的
.addTempPara("code", "666777").build();
try {
SendSMSResult res = client.sendTemplateSMS(payload);
System.out.println(res.toString());
} catch (APIRequestException e) {
e.printStackTrace();
} catch (APIConnectionException e) {
e.printStackTrace();
}
}