leancloud-push-lite Library

LeanCloud Android SDK

License

License

GroupId

GroupId

cn.leancloud
ArtifactId

ArtifactId

leancloud-push-lite
Last Version

Last Version

5.0.17
Release Date

Release Date

Type

Type

jar
Description

Description

leancloud-push-lite Library
LeanCloud Android SDK
Project URL

Project URL

https://github.com/leancloud/java-sdk-all/tree/master/android-sdk
Source Code Management

Source Code Management

https://github.com/leancloud/java-sdk-all/tree/master/android-sdk

Download leancloud-push-lite

How to add to project

<!-- https://jarcasting.com/artifacts/cn.leancloud/leancloud-push-lite/ -->
<dependency>
    <groupId>cn.leancloud</groupId>
    <artifactId>leancloud-push-lite</artifactId>
    <version>5.0.17</version>
</dependency>
// https://jarcasting.com/artifacts/cn.leancloud/leancloud-push-lite/
implementation 'cn.leancloud:leancloud-push-lite:5.0.17'
// https://jarcasting.com/artifacts/cn.leancloud/leancloud-push-lite/
implementation ("cn.leancloud:leancloud-push-lite:5.0.17")
'cn.leancloud:leancloud-push-lite:jar:5.0.17'
<dependency org="cn.leancloud" name="leancloud-push-lite" rev="5.0.17">
  <artifact name="leancloud-push-lite" type="jar" />
</dependency>
@Grapes(
@Grab(group='cn.leancloud', module='leancloud-push-lite', version='5.0.17')
)
libraryDependencies += "cn.leancloud" % "leancloud-push-lite" % "5.0.17"
[cn.leancloud/leancloud-push-lite "5.0.17"]

Dependencies

compile (7)

Group / Artifact Type Version
com.squareup.okhttp3 : okhttp jar 3.12.1
com.squareup.retrofit2 : retrofit jar 2.5.0
com.alibaba : fastjson jar 1.1.70.android
org.ligboy.retrofit2 : converter-fastjson-android jar 2.1.0
org.java-websocket : Java-WebSocket jar 1.3.9
com.google.protobuf : protobuf-java jar 3.4.0
com.android.support » appcompat-v7 jar 26.1.0

Project Modules

There are no modules declared in this project.

LeanCloud Java/Android Unified SDK

LeanCloud Unified SDK 包含 LeanCloud 平台全部功能的客户端接口,适用于 Java 和 Android 两个平台。

SDK 中所有存储 API 接口与 LeanCloud 云端交互严格遵循 LeanCloud REST API 规范,并且全部采用了 Reactive 函数式编程风格来设计(同时也兼容老的 Callback 方式)。

要想了解更多使用信息,请查看 Wiki.

Development Progress

注意:此 SDK 当前还在开发中,我们会逐步提供全平台的功能。最新进度如下:

存储服务 library(Java/Android 两个平台)

  • AVObject 增删改查
  • AVQuery 与 AVCloudQuery
  • AVUser 内建账户系统
  • Role 与 ACL
  • AVStatus

云引擎 library

  • EngineFunction
  • EngineHook
  • IMHook

实时通讯核心 library

  • LiveQuery
  • RTM

Android 推送和实时通讯 library

  • LiveQuery
  • RTM
  • Push

Android 混合推送 library

  • 华为 HMS 推送
  • 小米推送
  • 魅族推送
  • Firebase Cloud Messaging

Migration to 7.x

从 7.0.0 版本开始,我们将 Java Unified SDK 底层的 JSON 解析模块完全切换到了 Gson,开发者在业务层使用 Java Unified SDK 与 JSON 解析库,主要有如下三种情形:

  1. 业务层并没有特别使用 JSON 解析库,JSON 解析属于 Java Unified SDK 的内部实现细节,一般情况下开发者感知不到这一改变,所以这时候应用层可以无缝切换。
  2. 业务代码中因 Java Unified SDK 的原因顺带使用了部分 fastjson 核心类型(例如 JSONObject 和 JSONArray),要切换到最新版就需要去掉这些 fastjson 核心类的使用。出于兼容目的 Java Unified SDK 也提供了完全相同的 API 接口,所以开发者在升级的时候只需要将引用的包名由 com.alibaba.fastjson 替换成 cn.leancloud.json 即可,例如:
//import com.alibaba.fastjson.JSON
//import com.alibaba.fastjson.JSONObject
//import com.alibaba.fastjson.JSONArray

import cn.leancloud.json.JSON
import cn.leancloud.json.JSONObject
import cn.leancloud.json.JSONArray
  1. 业务层自主使用了 fastjson 解析库,例如访问了 LeanCloud 之外的 REST API Server,强依赖 fastjson 进行了数据解析,此时最好不要升级到新版本(除非能容忍同时引入 fastjson 和 Gson 两套解析框架)。

参考 demo:

其他问题:

  1. 升级到 7.0.0-SNAPSHOT 之后,Android Studio 打包时出现 RuntimeException,出错信息如下:
java.lang.RuntimeException
        at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:148)
        at org.objectweb.asm.ClassReader.readModule(ClassReader.java:731)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:632)
        at com.google.firebase.perf.plugin.instrumentation.Instrument.instrument(Instrument.java:151)
        at com.google.firebase.perf.plugin.instrumentation.Instrument.instrumentClassesInJar(Instrument.java:100)

按照这里的解释,可以通过升级 Android Gradle plugin -> 3.5.3, Gradle -> v5.5 解决。

  1. 能不能让开发者配置使用 fastjson 还是 Gson?

我们有计划将 Java Unified SDK 核心代码和 JSON 解析库分开,以后开发者可以根据自己的需求配置使用 Gson 或者 fastjson,类似于 retrofit2 的 converter factory,开发排期则要视开发者的需求而定。

Bugs and Feedback

大家使用中发现 Bug、或者有任何疑问或建议,请使用 GitHub Issues 来告知我们,非常感谢大家的反馈。

License

Copyright (c) 2017-present, Meiwei Shuqian(Beijing) Information Technology Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
cn.leancloud

LeanCloud

Build better apps, faster.

Versions

Version
5.0.17
5.0.16
5.0.15
5.0.14
5.0.13