Code Monkey home page Code Monkey logo

xivelyandroid's Introduction

Xively Android library (BETA)

Please note that this library is still in beta.

Overview

This is an Android remote (AIDL) service for accessing Xively API asynchronously.

The implementation can be found under service subdirectory.

An example of the consumer of this service can be found under demo subdirectory.

It uses Android's URLConnection for handling HTTP requests and have no external dependencies.

It is deliberately designed to be very lightweight. For a fully featured HTTP client library, check out our Java library.

It currently supports API9 (Gingerbread) to API17 (Jelly Bean).

Copyright

This library is Open Source, under the BSD 3-Clause.

Copyright © 2003-2013 LogMeIn, Inc. All rights reserved.

See LICENSE.md for full text of the license.

Xively Credentials

You will need to set your API key and feed ID in these files:

  • test/src/com/xively/android/service/test/HttpServiceTest.java
  • demo/src/com/xively/android/consumer/DemoActivity.java

Configuring Android Service Consumer

The consumer of this service will be able to access Xively API via all methods defined in the IHttpService.aidl.

As seen from the demo project, the following files must be present in the consumer as per AIDL service specified by Android:

com.xively.android.service.Response.java
com.xively.android.service.IHttpService.aidl
com.xively.android.service.Response.aidl

The name of the intent this service listens to is com.xively.android.service.HttpService, as per the AndroidManifest.xml:

    <service android:name="com.xively.android.service.HttpService" >
        <intent-filter>
            <action android:name="com.xively.android.service.HttpService" />
        </intent-filter>
    </service>

Multiple client apps can connect to this service if the include the above snippet on AndroidManifest.xml.

HTTP Service

RESTful requests to Xively API are managed by HttpService when invoked by an intent.

The service uses AsyncTask to make the request.

The response is expected to return from AsyncTask within the time as specified in HttpService.DEFAULT_TIMEOUT.

An exception will be thrown otherwise.

Exception Hierarchy

All exception thrown out of this library is RemoteException, as prescribed by AIDL specification.

For compatibility with Android version before API15, any caught exception in this service will be returned as a response with its status that represents an exception condition (HTTPService.HTTP_SERVICE_ERROR).

Data Formats

The response from the service can be retrieved as string:

response.getContent()

which the client can then easily turned into a JsonObject by:

new JSONObject(response.getContent())

githalytics.com alpha

xivelyandroid's People

Contributors

errordeveloper avatar baz44 avatar ericwaynedavis avatar s0pau avatar

Watchers

 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.