ANNOUNCEMENT: Mobile SDKs beta release

Mobile Software Development Kit beta announcement

Today, we’re excited to launch a beta version of the much anticipated Mobile Software Development Kits (SDKs). With this release, you are no longer on your own when building an app for your Spark-powered product or prototype — we are providing tools to make it easy to interact with the Spark cloud from your mobile device. iOS support is here, Android support is coming soon!

The Elite and Champions have already had a chance to tinker around with these SDKs, and now we’re looking for your feedback!

Multi-layered SDK

There are two parts to this SDK beta release: the Cloud SDK and the Device Setup library.

Cloud SDK

The Cloud SDK is a library that enables your mobile app to interact with internet-connected hardware through the Spark Cloud. It serves the same purpose as Spark JS — it’s an easy-to-use wrapper for our REST API, accessible from beautiful, idiomatic Objective-C and Swift. Using the Cloud SDK, you can:

  • Manage user sessions for the Spark Cloud (access tokens, encrypted session management)
  • Claim/Unclaim devices for a user account
  • Get a list of instances of claimed Spark 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 cloud operations take place asynchronously and use the well-known completion blocks (closures for swift) design pattern for allowing you to build beautiful responsive apps for your Spark products.

Device Setup library

The Device Setup library allows you to create a setup wizard for connecting your device with two lines of code.

As you may have heard, the wireless setup process for the Photon uses very different underlying technology from the Core. Where the Core used Smart Config, the Photon uses what we call “soft AP” — the Photon advertises a Wi-Fi network, you join that network from your mobile app to exchange credentials, and then the Photon connects using the Wi-Fi credentials you supplied.

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 has been passed an instance of the device she just setup and claimed.

It’s pretty magical.

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 Sparky? Well, for that, we’ve made the setup UI super easy to customize! There’s a customization proxy class that includes properties such as: custom colors, texts, fonts, brand logos and a placeholder for an instructional video file for setting up your product. 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.

How To Get Started?

iOS

Both the Cloud SDK and Device Setup library are available through CocoaPods, the most widely used iOS dependency manager. If you don’t have it, you’ll need to start by installing the cocoapods ruby gem; check out the CocoaPods site for more info.

Then, to install the Device Setup library for iOS (which has the Cloud SDK as a dependency), simply add the following line to the Podfile in your iOS project root folder:

pod "SparkSetup"

You can find the documentation here (currently on cocoadocs.org website, we’ll have full documentation and usage coverage soon):

Documentation for iOS Cloud SDK

Documentation for iOS Device Setup library

In addition you can simply consult the javadoc style comments for each SDK public method for detailed usage explanation.

The mobile SDKs use the same LGPL license as most of our open source repositories, so submitting issues and contributions through pull requests is most welcome!

You can find the source code in our GitHub:

Repository of iOS Cloud SDK

Repository of iOS Device Setup library

There’s also an example app in Swift that demonstrates the basic usage of invoking the setup wizard, customizing its UI and using the returned SparkDevice class instance once Device Setup wizard completes.

Android

We’re still working on Android, but it’s not far behind. The overall process is very similar, but it’s a native Java experience so Android developers will feel right at home.

One big difference in the user experience of setting up a Photon from an Android app vs. an iOS app is that on Android an app can control which Wi-Fi network the phone connects to, whereas on iOS the user has to leave the app, go to settings, and change the Wi-Fi network. We’ve made both flows as easy as possible, but it’s definitely smoother on Android since the user doesn’t have to do as much.

The Cloud SDK and Device Setup library for Android will soon be available on our GitHub and through JCenter as Apache Maven packages.

Go Forth and Build Apps!

We’d love to hear what you think of the mobile SDKs so far. We’re so excited to get your valuable feedback in this thread! That being said, a couple of things to keep in mind:

  • We will announce the Android SDK the moment it becomes available (did we say soon?)
  • This is not a finished product, and there will likely be bugs found. We wanted to focus on shipping you all something quickly to begin iterating based on feedback and usage. We don’t expect this to be production-ready, and neither should you! There are numerous additional features and elements coming—this is just a start :smile:
  • We so 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 Spark 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 mobile SDKs to use!
Thanks for being awesome!

15 Likes

Great job :+1:

But one thing I really would like to see in future, would be support for Windows Phone too.

Granted, it’s not one of the big players in mobile devices, but maybe with Win 10 the ubiquitous negligence for Win as mobile OS might be overcome a bit easier in future.

Excellent! Looking forwards to the Android release!

I had a question about the mobile SDK pub/sub. Will there be any limitations there? Such as a mobile phone can only subscribe to events from devices and not other mobile phones? And what will the ID be of the published event?

I only ask because it seems this could be opened up for many things besides Spark devices. For example, could I use the Spark cloud to build a messaging app from one mobile to another without ever paying for anything on the Spark cloud? Will there be restrictions to block this? If so, what will they be?

Looking forward to the Android release!. To be honest I have no experience or iOS devices. I will mainly create a widget with your own custom switches and functions, after that, we will see!

1 Like

Particle Mobile SDKs beta, now available for everybody!

Expect frequent version upgrades for the iOS cocoapods libraries:

  1. Cloud SDK - iterating on adding new functionalities, fixing bugs
  2. Device Setup lib - iterating mostly on UI improvements and customization points

Android SDK will follow suit real soon, so just a little more patience Java coders…

We will be updating mentions of “Spark” to “Particle” in the codebase and posting new Particle-named libraries soon too, that should not affect your app development for now.

Show us what you do with the Mobile SDKs on the (now public) Mobile category in Particle community!

Could there be a browser app version of the device setup? Someone with a computer with wifi and a browser could set it up. Or is this something that would have to be done over CLI or a phone?

1 Like

I strongly suggest that spark to partner with basic 4 android for rapid development. See b4A website, write in vbasic style for Android. It wil be mind blowing if you have the sdk /lib for the b4A

Scruffr, i suggest you to visit basic 4 amdroid. Write in visual basic style for android and ios. Paid tool, yet simple n time saving

For now soft AP (photon setup) process can indeed be done from CLI or from an Android/iOS device.
Good news: we do plan to add HTTP command interface to the Photon firmware in the future so web browser setup will become possible.

Visual Basic for Android sounds really nasty stuff, but I understand somebody might still want to go down that route.

My opinion is a request like this should be directed toward b4a support rather than to Particle’s dev team: it’s b4a trying to wrap Android stuff into VB, not the other way around.

I would be definitely interested into the web interface!

What’s the timeline on the android libraries? And are any .Net libraries planned?

Is there documentation on the APIs besides existing implementations?

Hi @alterschw3de
Android libs should be released within the next 2 weeks. No plans for .net libs for now.
Sure, there’s plenty of documentation for the iOS library alongside useful examples right here:
http://docs.particle.io/photon/ios/
similar documentation will be provided for Android libs once we release them.

@sam_desd:
There’s crazy amount of 3rd party dev tools/cross-platform tools for the mobile world, we cannot be releasing support for all of them but would love to see community contributions in this field. I’d start with the bigs ones i.e. Xamarin and Titanium. Anyhow I’d still stick with native development for iOS + Android as all those 3rd party “cross-platform” tools end up limiting your ability to do advanced apps, usually are MUCH slower to run on device, require some heavy runtime environment, have limited community/support, and are S-L-O-W in adapting to new technologies & APIs from Apple/Google. For me - it’s a thumbs down.

2 Likes

I think this is a great move, thanks for providing an SDK for Android!

ADDITIONAL ANNOUNCEMENT:
I open-sourced the iOS Particle Tinker app today for your reference.
The app is consuming the Device Setup lib and the Particle iOS SDK, so this is an excellent resource.
You can find it here:

Enjoy

2 Likes

Hi @ido

Has the android device setup library been released?

If so can you give a link?

Thanks

At the moment only the Android Cloud SDK has been published and will soon be available as JCenter dependancy for easy installation in any Android Studio project. Android device setup lib will be published soon (hopefully within 1-2 weeks max). I’ll create an announcement once all the Android libs are out.

With respect to the iOS Device Setup library, can anyone comment on if/when you guys have the following features planned for release?

  1. The ability to specify our own device picture in the setup workflow
    (it looks like it was previously implemented but commented out).
  2. The ability to set or modify the text for each instructional step - the
    current content carries with it a few assumptions that don’t carry
    over to our product.
  3. The ability to specify login information for the Particle account -
    this is crucial for those of us that do our own account management.

Thanks!