Hi! 👋

Today I’d like to introduce you into a beacons and how to became a beacon using only your phone and a Flutter. Let’s start!

What’s a beacon?

Beacon is a small device, operating on batteries that can last for a few years. It can send a radio signal and communicate with smartphones via Bluetooth. The name is not without a reason — when we go near the beacon, it can contact the application on our phone and display the information we need, refer us to the store or informs us about the current place.

For instance, if you walk into the museum (with your Bluetooth on), you can get the informations about the artpiece whenever you pass it by!

The possibilites are endless. Airports, shops, museums, bus stops, shopping centers, music festivals, galleries, smart homes. The list of examples is huge.

But why use your phone instead of a beacon?

Beacon is a great device. It’s small, so you can hang it almost enywhere. It looks nice on the walls, next to the cash desk or… even on the trees.

Beacon on the tree. Source: Jona Nalder

But beacon is… another device. You need to buy it and remember about changing to the new one when batteries are out (it needs to be done every 1-2 years, but still). What about using the device you already have, your phone? The answer is good — you can!

How to turn your phone into a beacon?

I faced this issue some time ago. There are ready-made solutions for both platforms, e.g. AltBeacon library for Android or CoreLocation for iOS. But there was nothing for Flutter. So I decided to… write it on my own!

I made a plugin that makes all the work for you. All you need to do to turn your phone into beacon is to add a plugin to your Flutter project:

dependencies:

beacon_broadcast: ^0.2.1

And then after running flutter pub get command you’re ready to go:

import 'package:beacon_broadcast/beacon_broadcast.dart'; BeaconBroadcast()

.setUUID('39ED98FF-2900-441A-802F-9C398FC199D2')

.setMajorId(1)

.setMinorId(100)

.start();

To check more options (e.g. setting beacon layout, manufacturer, transmission power), visit the plugin site.

That’s all! I hope you’ll find this post (and my library!) useful. If you have any comments or feedback, don’t hesitate to left it.