Giter VIP home page Giter VIP logo

jiguang-sdk-java's Introduction

jiguang-sdk-java

这是 Jiguang REST API 的 Java 版本封装开发包,是由极光推送官方提供的,一般支持最新的 API 功能。

对应的 REST API 文档:

支持 Java JDK 1.8 及其以上版本。

支持 Java JDK 1.6 版本:jpush-api-java-client,但不再更新。

1. 集成

引入sdk包

<!--以5.0.8版本为例-->
<dependencies>
        <!-- jiguang-sdk -->
        <dependency>
            <groupId>io.github.jpush</groupId>
            <artifactId>jiguang-sdk</artifactId>
            <version>5.0.8</version>
        </dependency>
</dependencies>

引入log包

注意项目中已引用了logback、log4j、commons-logging等实现slfj接口的日志框架,则不需要配置。例如'example-for-spring'中引入了spring,自带logback框架,就不需要再配置。

<!--以logback为例-->
<dependencies>
    <!-- logback -->
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.11</version>
    </dependency>
</dependencies>

2. Api

创建api对象

可根据自身情况设置host、proxy和loggerLevel

        // appKey和masterSecret在极光官网-应用控制台获取
        PushApi pushApi = new PushApi.Builder()
            .setAppKey(appKey)
            .setMasterSecret(masterSecret)
            .build();

        DeviceApi deviceApi = new DeviceApi.Builder()
            .setAppKey(appKey)
            .setMasterSecret(masterSecret)
            .build();

        ReportApi reportApi = new ReportApi.Builder()
            .setAppKey(appKey)
            .setMasterSecret(masterSecret)
            .build();

        // devKey和devSecret在极光官网-右上角-个人主页获取
        AdminApi adminApi = new AdminApi.Builder()
            .setDevKey(devKey)
            .setDevSecret(devSecret)
            .build();

使用api示例

jiguang-sdk-java's People

Contributors

wicked-tc130 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jiguang-sdk-java's Issues

新版本的短信推送API移到那里去了

在旧版本中我是用如下的代码发送短信
SMSPayload payload = SMSPayload.newBuilder() .setMobileNumber(mobilePhone) .setTempId(1) .addTempPara("code", code) .build();
但是新版本找不到直接使用手机号发短信的地方,在官网也看不到介绍,想了解这个API现在移到那里去了

SDK bug

https://report.jpush.cn/v3/received/detail
送达统计详情 的接口 在 SDK5.0.5 版本中 对应的响应实体类 ReceivedDetailGetResult 成员属性的 json 映射字段是错误的。
Unrecognized field "live_acivity_send"
对应的成员变量:
@JsonProperty("live_acivity_sent")
private Long liveAcivitySent;

导致相应数据反序列化失败,抛出异常

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.