The Android SDK is Finally Here!
We’re excited to finally launch the much anticipated Mobile Software Development Kit for Android OS. With this SDK, you are no longer on your own when building an Android app for your Particle-powered product/prototype — we are providing tools to make it easy to interact with the Particle cloud from your mobile device!
One SDK Two Parts
As in the iOS SDK there are two parts - the Android Cloud SDK and the Android Device Setup library.
Android Cloud SDK
The Cloud SDK is a library that enables your mobile app to interact with internet-connected hardware through the Particle Cloud — it’s an easy-to-use wrapper for our REST API, accessible from Java in Android Studio. Using the Cloud SDK, you can:
- Manage user sessions for the Particle Cloud (access tokens, encrypted session management)
- Claim/Unclaim devices for a user account
- Get a list of instances of claimed Particle devices
- Read variables from devices
- Invoke functions on devices
- Coming Soon: Publish events from the mobile app and subscribe to events coming from devices
All Android SDK methods are intentionally implemented as synchronous, blocking calls, including network calls. This blocking API avoids nested callbacks and other complexity, making it easy to write a series of synchronous calls while on a non-UI thread.
The SDK also ships with a handful of helpful utility classes tailored specifically to the Particle device interaction use cases.
###Android Device Setup Library
The Particle Device Setup library provides everything you need to offer your users a simple initial setup process for Particle-powered devices. This includes all the necessary device communication code, an easily customizable UI, and a simple developer API.
With the Device Setup library, you make one simple call from your app, for example when the user hits a “setup my device” button, and a whole series of screens then guides the user through the soft AP setup process. When the process finishes, the user is back on the screen where she hit the “setup my device” button, and your code can listen on a broadcast to retrieve an instance of the device class user has just setup.
But what if you have your own branding in the rest of your app and don’t want the setup wizard to suddenly change to look Particley? Well, for that, we’ve made the setup UI easy to customize! There’s a customization.xml
resource file includes modifiable properties such as: custom colors, texts, fonts, brand logos etc. There are good defaults if you don’t set these properties, but you can override the look and feel as needed to suit the rest of your app.
Simple Integration
Both the Cloud SDK and Device Setup library are available as Gradle dependencies via JCenter, the default dependency management tool for Android Studio. The TL;DR version of installing the Cloud SDK, is simply adding the following line to your project build.gradle
:
compile 'io.particle:cloudsdk:0.1.3'
or for the Device Setup library:
compile 'io.particle:devicesetup:0.1.3'
Please refer to full documentation with detailed installation instructions and example usages:
Android Cloud SDK docs and Android Device setup library docs.
The Android SDK uses the same Apache 2.0 license as the iOS SDK allowing easy conflict-less distribution of apps developed using it in Google’s Play store.
You can find the full source code in our GitHub:
The Device Setup Library project also contains a simple example app that demonstrates the basic usage of invoking the setup wizard.
Important: You can also refer to the (recently) open-sourced Particle Tinker app for Android for further reference on how to use and consume the SDKs!
Go Forth And Build Great Apps!
We’re so excited to get your valuable feedback in this thread! That being said, a couple of things to keep in mind:
- The Android SDK is a bit behind our iOS SDK in terms of features and functionalily, we’ll be updating the Android SDK with new features as they become ready.
- We appreciate your feedback, thoughts and ideas. Please keep them coming! We’re building this for all of you, and we will incorporate your feedback into future versions of the mobile SDKs!
Our goal at Particle is to make it as easy as possible to build IoT products, from prototype all the way into production, and beyond. This is just one more way we’re putting the power in your hands to create an amazing experience for your users.
We’re seriously stoked to see how you are going to put the Android SDK to use!
Thanks for being awesome!