Git Product home page Git Product logo

leancloud-rest-api-sdk-java-client's Introduction

Leancloud Rest Api Java Client Library (For Java Server)

概述

这是 Leancloud Rest Api 的 Java 版本封装开发包,适用于Java Server 和Rest Api通讯访问。

还在完善更多的 1.1 版本Rest API 功能中。

对应的 REST API 文档:https://leancloud.cn/docs/rest_api.html

初始化

下片断来自项目代码里的文件:test / cn.leancloud.api.LCClientTest

    //id, key, apnsProduction
    LCClient client = new LCClient(id, key, false);        

安装数据

	Map data = new HashMap();
    data.put("deviceType", "ios");
    data.put("deviceToken", token);
    List<String> channels = new ArrayList<String>();
    data.put("channels", channels);
    LCInstallation installation = client.installationsCreate(data);

Push 通知

https://leancloud.cn/docs/push_guide.html#使用-rest-api-推送消息

  • 构建推送对象:真对某一个Installation ObjectId, 通知内容为 ALERT。
    client.sendNotificationAlertWithObjectId("hello test world...", objectId);
  • 构建推送对象:可以更丰富的进行设置,内容是 show me 通知 ALERT,并且附带extra data
    /**
    {
        aps =     {
            alert = "show me";
            badge = 1
            sound = default;
        };
        type = 001;
        url = "http://leancloud.cn";
    }
    **/
    
    Map data = new HashMap();
    data.put("alert", "show me");
    data.put("sound","default");
    data.put("url","http://leancloud.cn");
    data.put("type","001");
    data.put("badge", "Increment");
    BaseResult result = client.sendNotificationObjectId(data, objectId);

License

Distributed under GNU Lesser General Public License .

leancloud-rest-api-sdk-java-client's People

Contributors

daheli avatar liumeng1201 avatar

Stargazers

 avatar

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.