React Native at an IoT Start Up

felix-mooneeram-222805.jpg

By Matt Dupree, Senior Mobile Developer at UniKey Tech

If you saw a toilet seat in a movie theater, you’d probably think to yourself, “Wait a minute. You don’t use that in here.

Many of us have a similar reaction when we think of using React Native at an IoT startup:

Wait a minute. React Native is fine for light-weight apps, but IoT companies need apps that make heavy use of the phone’s hardware, so don’t use it in this situation. Just don’t use that here.

My goal in this written version of my talk is to convince you that using React Native with hardware-intensive applications is not like using a toilet seat in a movie theater. Along the way, I’ll go over why we (at UniKey) adopted React Native, how we used it in our apps, the results we’ve achieved using it so far, and the trade-offs/challenges we’ve faced.

Why

I originally approached React Native a little over a year ago with loads of skepticism. I had heard all the horror stories of companies getting burned by first-generation cross-platform mobile dev tools, so I had a hostile view of cross-platform tools in general. React Native was no exception.

Eventually, I noticed that an increasing number of impressive companies had adopted React Native and this caught my eye:

who-is-using-react-native.png

My favorite app on this list is Skype. Microsoft owns Xamarin and they choose React Native for Skype. I think that speaks volumes.

With the increasingly impressive roster of these companies in the back of my mind, I stumbled upon an opportunity to do some pro-bono work for a charity. They needed an iOS and Android app, and I decided that React Native would be a good choice for building their app. It was a simple food pantry app with a form, and React Native did the job very well:

fed40.png

Fast forward 1 year, and we’re staring down the barrel of a pretty hairy deadline. UniKey partners with lock manufacturers to build smart lock products. We provide white-label apps, SDKs, and hardware reference designs so that partners can launch in months instead of years. Essentially, a core part of our value proposition is speed; making React Native a valuable framework. One of React Native’s core value propositions is to improve developer productivity by, among other things, sharing code between Android and iOS. The productivity gain is something we needed, but some folks were still skeptical of React Native in general and even I wanted to see proof of the React Native app working with our UniKey SDK before we struck out on this path.

I pitched my team on staying up all night to build a prototype React Native app with our SDK to prove that it was the way forward for hitting our deadline. They were down because they’re awesome and we built the thing in a night. That went a long way towards helping folks feel comfortable with the path we were taking.

How

react-native-arch.png

So, that’s why we adopted React Native at UniKey.

Let’s talk about how we did it. Here’s a very basic diagram, you’ll find to the right, of the architecture for the apps:

At the top, we’ve got our UI code written in javascript with React Native. In the middle, we’ve got a bridge layer that mediates communication between the javascript layer and our UniKey SDK, which is the bottom layer in the diagram.

Results

Overall, we were very pleased with how things turned out. We were able to hit our deadline and our React Native apps work well. One of the things that I think allowed React Native to work so well for us is that the bread and butter of the experience of our apps doesn’t actually need to communicate with the React Native code at all. Our apps aim to allow you to access your home or office in a way that is more convenient than the key.

With our apps, you don’t even have to open the application in order to unlock the door. Because of this, our SDK does all the heavy-lifting with the hardware and doesn’t even need to talk to the React Native code in order to perform its most important function. In other words, there’s no performance penalty in using React Native for “passive entry” into a UniKey powered smart lock.

What’s really interesting about our work with React Native is that because we white-label apps and create SDKs, we can actually easily create fully-native and React Native apps and compare them side-by-side to see the results.The side-by-side comparison is impressive. You might even have a hard time telling which app is native and which is React Native.

Conclusion

So, there you have it: the how, why, and results of our usage of React Native at UniKey. If you’re working on an IoT product, I hope I’ve convinced you that using React Native is more appropriate than using a toilet in a movie theater. To read Matt’s full post visit https://goo.gl/74ECDC.

Check out UniKey Technologies

For more information on UniKey Technologies, it’s projects, developers, and more visit www.unikey.com.