Bridgefy Meets Android Things

Roberto Betancourt
bridgefy
Published in
6 min readJun 9, 2017

Since the inception of Bridgefy, we have understood the power that IoT devices would bring in our mission to “Connect the Unconnected”. However, it had never been feasible to port our mobile P2P and Mesh technology to embedded devices due to the lack of a unified developer platform and the myriad of devices in the IOT ecosystem. For our small team that already has its hands full with our Android and IOS SDKs, it just wasn’t possible.

That’s why we were so excited when Android Things was first announced. The promise of having the same code base for Android mobile phones and embedded devices running Android Things would truly be a game changer and it almost sounded too good to be true so we were also a bit skeptic. We were mentally preparing ourselves to having to build a separate version of the Bridgefy Android SDK with cut-down features and reduced compatibility.

When we finally got a chance to start experimenting with the Android Things Developer Preview 4 and a Raspberry PI 3 we realized our concerns were unfounded. Excluding some minor adjustments for the hardware constraints of embedded devices, we were able to run the our Android SDK essentially untouched on the PI 3 with the full features of the Bridgefy technology.

Everything from flashing the Android Things image to adding app support was extremely easy.

Flashing Android Things to your device

The process of flashing the Android Things image varies from device to device so check the official documentation for specific instructions. For our tests, we chose the Raspberry Pi3 which offers great Bluetooth 4.1 connectivity. The latest system image can be found in the official Android Things site as well as platform-specific instructions to flash them

Connecting to the Raspberry Pi

The recommended setup before booting your Raspberry PI is to have at least an HDMI screen and an ethernet cable connected to it. Both are not entirely necessary but will make the process of connecting to it a lot easier. When you connect the USB power supply, the booting process will start automatically and should finish in under a minute. If you plugged in an HDMI display, you should see something like this:

Now that you know the IP address, you can connect to the raspberry with adb.

$ adb connect <ip-address>

If you don’t have access to a display, you might be able to connect to it via its hostname Android.local. This may or may not work depending on your network’s Multicast settings.

If the connection is successful, the Raspberry will become available from Android Studio to launch and debug apps:

Adding Android Things support to your app

Adding Android Things support to a regular app is also shockingly easy; just add a couple of lines to your AndroidManifest.xml, add the corresponding dependency to your app’s gradle file and you’re good to go.

Bridgefy, IoT and Android Things

Now that you have your device up and running, you’re all set to start your cool IoT project. But wait! Does your app involves some level of connectivity to other devices and platforms? (Hint: It probably does). Is your app ready for offline-first scenarios when you won’t have internet connectivity? Do you really want to get involved with the bugs and nuances of the Bluetooth and WiFi API’s for Android? This is where Bridgefy can be helpful for you; Our SDK hides away all of the complexities of wireless communications to let you focus on your app.

This is how easy it is to use the Bridgefy SDK to communicate with other devices:

Talking to a Raspberry PI in our Chat sample app

All of our sample apps on Github already have Android Things compatibility just to show how easy it is to integrate both of them.

What’s next?

Well, this opens the door to many possible new solutions and integrations for IoT using the Bridgefy SDK!

We can imagine some of the solutions using Android Things + Bridgefy SDK that we want to share with everyone.

Highways and Transportation

Did you get stranded on the middle of the night because your car broke down?

Is there no easy and fast way to warn others in traffic that you’re having a problem some miles ahead? All of this, with no phone service or data available because you’re nowhere near a city?

Why not create a solution with Bridgefy where people can alert others of their car being stranded, by using their Android or iPhone phones, and then that alert can turn into a series of visual lighting alerts miles behind for the other people in the highway?

Using Bridgefy you could create a solution with any Android Things-compatible device and mesh network integrations.

Sensors and monitoring

What if urban infrastructure could use the power of the Bridgefy SDK and Android Things devices so they could be interconnected and be able to create a mesh network even when phone and Internet services fail?

What if you could monitor those sensors in real time on a cell phone or tablet that have Bridgefy integrated?

Natural disasters and emergency situations

What about creating a solution with an Android Things device that has an integrated battery, supporting +8 hours, using Bridgefy SDK? Something like an intelligent tool for spontaneous network creation and emergency communications for everyone to use, even in places with difficult communications access.

Imagine little repeaters providing an easy way for people to share their location or let others know of a dangerous situation without much configuration other than having a cell phone with Bluetooth and an app with Bridgefy SDK integrated!

We could save lives with a good Bridgefy and Android Things integration on an IoT setting.

Those are only some of the ideas that come to our minds.

We can’t wait to see what developers around the world do with the power of Bridgefy and Android Things!

We’d love to hear what you think! Contact us via email, Twitter, and/or Facebook!

--

--

Roberto Betancourt
bridgefy

Developer, startup cofounder @bridgefy and bike dude