leanCloud使用的时候心得
来源:互联网 发布:手机图文设计软件 编辑:程序博客网 时间:2024/05/16 10:38
第一步:https://leancloud.cn/docs/rest_api.html#获取对象
先查看该文档清楚请求的格式 比如header里都需要什么参数 严格按照
第二步:https://leancloud.cn/dashboard/apionline/index.html#!/classes/查询对象_get_3
清楚自己客户端绑定的url及返回的参数:
https://leancloud.cn:443/1.1/classes/devices/58cfa8311b69e6006b8876ad
第三步:创建对应的app一些对应的参数
第四步:创建对应的表:创建表的时候注意ACL权限(重点)可读模式
第五步:代码示例:读取时候切记有的是response.body().toString();可读取内容
有的是response.body().string();;可读取内容
private static finalStringURL="https://leancloud.cn:443/1.1/classes/devices/58d0e2f244d90400684d26e4";
private static finalStringAPP_ID="onXRojJheCxxxxxx-gzGzoHsz";
private static finalStringAPP_KEY="SUB7qOw1qQvxxxxxxx";
public static voidcheckRegiste(finalActivity mainActivity) {
if(okHttpClient==null) {
OkHttpClient.Builder builder =newOkHttpClient.Builder();
okHttpClient= builder.build();
}
Request.Builder resBuilder =newRequest.Builder();
resBuilder.addHeader("X-LC-Id",APP_ID);
resBuilder.addHeader("X-LC-Key",APP_KEY);
// resBuilder.addHeader("Content-Type", "application/json");
resBuilder.url(URL
// + "devices?where=" + URLEncoder.encode("{\"open\":\"" + true + "\"}")
);
okHttpClient.newCall(resBuilder.build()).enqueue(newCallback() {
@Override
public voidonResponse(Call call, final Response response)throwsIOException {
newHandler(Looper.getMainLooper()).post(newRunnable() {
@Override
public voidrun() {
try{
JSONObject data =newJSONObject(response.body().string());
if(data.optBoolean("to_death")) {
mainActivity.finish();
return;
}
}catch(Exception e) {
e.printStackTrace();
}
}
});
}
@Override
public voidonFailure(Call call,IOException e) {
e.printStackTrace();
}
});
}
0 0
- leanCloud使用的时候心得
- leancloud 使用的坑lists
- 使用LeanCloud的分页查询
- Android:使用LeanCloud遇到的坑
- 记录使用 LeanCloud 的两年
- 微信小程序 使用LeanCloud
- 一起疯狂使用 LeanCloud
- 分享一下我使用android 源码时候的心得!
- LeanCloud
- leancloud nodejs 加密使用方式
- LeanCloud Feedback 使用出错问题解决
- leancloud-swift 使用小手册
- 如下主要记录在学习使用EXTJS结合WCF的时候的一些心得
- 一个数据存储使用的 Leancloud、架构采用 MVP 的记账本 APP
- 使用LeanCloud注册功能让邮箱在界面可选的方法
- android-studio - 在android studio上使用LeanCloud开发遇到的问题
- LeanCloud使用入门(android),leancloudandroid
- 微信小程序 LeanCloud(二)命令行工具使用
- 敌兵布阵 (线段树求和)
- maven实战(二)maven定制一个项目
- OpenCV3.2 Cmake生成 VS2015工程文件时出现问题解决方式
- Action接口和ActionSupport基类
- 通过virtualenv快速搭建Python虚拟环境Windows + ubuntu
- leanCloud使用的时候心得
- ext.form.field.Date
- X5之控制台
- 深入理解JAVA序列化
- hibernate的各种查询
- jdk 和 jre的定义和关系
- MFC 获取 exe 所在路径
- Ajax上传图片到服务器
- com.google.gson.JsonSyntaxException:com.google.gson.stream.MalformedJsonException的解决