spring boot 极光推送

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();
        }

    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值