Code Monkey home page Code Monkey logo

androidsdk's Introduction

SDK for Android

本项目是 中移物联网公司 为方便Android开发者接入 设备云 平台而开发的SDK。关于设备云请进入设备云主站了解详情。如果要了解OneNet API请进入 开发者中心 参考API文档

屏幕截图

screenshot1 screenshot2

说明

  • 使用gradle
allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}
dependencies {
    compile 'com.github.cm-heclouds:AndroidSDK:1.0'
}
  • 或者将 onenetapi-library 导入为 Android library,并将你的主工程依赖于 onenetapi-library
  • 此外你也可以将编译好的 jar 文件拷贝到工程的 libs 目录下或者将 onenetapi-library 的源码拷贝到工程的 src 目录下
  • 如果不想自己编译,也可以直接下载对应的二进制库文件onenetapi-library-release.jar

如何使用

示例

所有的请求都是通过com.chinamobile.iot.onenet.OneNetApi.java完成,以获取设备列表为例

	String apiKey = "xxxxxxxxxxx-xxxxxxxxxxxxxx-xxxxxxxxxxxx";

	OneNetApi.getInstance(context).getDevices(apiKey, null, null, null, null, null, null, new ResponseListener() {

    	@Override
    	public void onResponse(OneNetResponse response) {

        	// 获取原始响应
        	String rawResponse = response.getRawResponse();

        	if (response.getErrno() == 0) {
            	// 请求成功
            	String data = response.getData();
        	} else {
            	// 连接服务器成功,但请求发生错误
            	String error = response.getError();
        	}

    	}

    	@Override
    	public void onError(OneNetError error) {
        	// 网络或服务器错误
        	error.printStackTrace();
    	}

	});

更多示例请参考Sample中的代码,运行前请将SampleApp中的sApiKey修改为你的项目下的APIKey

androidsdk's People

Contributors

chenglei1986 avatar

Watchers

yfrobot-zl 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.