ANNOUNCEMENT: Android SDK finally here!

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!

10 Likes

The GitHub links return 404.

“Repository of Android Cloud SDK”
“Repository of Android Device Setup library”
“Particle Tinker app for Android”

Oh, thanks for this catch. Fixed!

“Particle Tinker app for Android” is still returning a 404.

Yes, the “Particle Tinker app for Android” would be very helpful (it returns 404 for me).

OK, sorry about that - the Tinker app for Android is now public, no more 404s.
Enjoy!

Cool. Thanks!

Working Great!!!

Thanks !!!

Is there any timeframe on when the Android Cloud SDK will catch up to the iOS Cloud SDK, specifically with regards to event handling?

2 Likes

Adding compile ‘io.particle:devicesetup:0.1.3’ to build.cradle dependencies fails with this:

Error:A problem occurred configuring project ‘:app’.

Could not resolve all dependencies for configuration ‘:app:_debugCompile’.
Could not find io.particle:devicesetup:0.1.3.
Searched in the following locations:
https://jcenter.bintray.com/io/particle/devicesetup/0.1.3/devicesetup-0.1.3.pom
https://jcenter.bintray.com/io/particle/devicesetup/0.1.3/devicesetup-0.1.3.jar

Can someone confirm the devicesetup library is properly deployed to JCenter? I receive a not found error. .

Latest version of devicesetup android package in JCenter is 0.2.0
https://bintray.com/particle/android/devicesetup/view

Please give it a try and let us know if there’re still issues.

I now get this Gradle error. Same error is present in exampleapp (https://github.com/spark/spark-setup-android)

Error:Failed to resolve: com.afollestad:material-dialogs:0.7.8.0


fixed this problem by adding this to build.gradle:
repositories {
maven { url “https://jitpack.io” }
}

I have no clue how to use Particle Android SDK within Appinventor? Please share information if some one knows. Thanks.

Yeah, there were some distribution problems with that library. An update to the setup lib has been published, 0.3.0 which fixes this issue.

Thanks for the heads up!

If App Inventor can use other Android libs from gradle dependencies or AAR files, then it should be able to use the SDK as well, and the instructions for setting that up would be the same.

Thanks for the new version.

Question for you. My project already manages users and I don’t want to create a Particle account for each end user. Instead they’ll all run under a master account.

Now, the problem is I need to modify the setup lib to not prompt for Registration and instead accept my master account. This would occur behind the scenes, prior to the wifi setup part.

Any suggestions on how this would be accomplished?

If you just want to pre-authenticate, you should be able to just call ParticleCloud.logIn() with your master account credentials. That ought to prevent the login/register screen from appearing.

(That said, you’re only going to be distributing this app with a “master account” internally right, not putting it on the Play store for the public?)

1 Like