I developed an app for my wedding

Written by mauriciomeirelles | Published 2017/02/18
Tech Story Tags: ibeacon | ios | swift | apple | weddings

TLDRvia the TL;DR App

After WWDC 2013, my first dubdub, when I was heading back home, I had a lot of new things to think about: iOS 7 with the end of skeuomorphism, the new MacPro, etc… But the thing that was most interesting to me was the iBeacon.

My term paper in 2007 was about using location awareness (first RFID, but I ended up using bluetooth on mobile phones) to draw a map based on your location inside a building. The approach I used was similar to iBeacon because the devices were not "connecting" to each other, they were just broadcasting their ID. I think this is why I was really excited with iBeacon, now I would have a standard way to develop apps using BLE as an indicator of presence.

During WWDC everyone was just talking about using it for marketing campaings, museums and… that’s it. I knew that it could be used for far more interesting things and I decided I wanted to do something with it. At that time I was teaching iOS for 100 students (50 in the morning, 50 in the afternoon) and the “classroom” was actually the entire floor of a building. It was really hard for me and for the other teachers to take attendance of the students, so I had an idea: use iBeacon to build an attendance app! Together with my friends we started working on it and after some time we already had a working version on the App Store. At that time I didn’t see any other nice use of iBeacon besides the same old marketing and museums… so when the app was ready I decided to send a press release to some websites and see what they think. Fortunately we were right and even TechCrunch publiced a note!

BeHere Lets Teachers Take Attendance Using iBeacon Technology_While Apple's iBeacon technology is already being adopted by both large and small retailers, we've started to see other…_techcrunch.com

Fast forward 2 years and once again I was going to WWDC, but this time I also had an important event in Vegas, I was going to get married! The first 2 things everyone asks when I say that I got married in Vegas is: "Were you drunk?" and "Is this for real?". The answer is yes and yes.

I know it looks like a stock photo, but this is really me and my wife

All my friends from work and part of my students would be there also, so I thought, it wouldn’t be awesome if I could develop an app for my wedding? I knew that everyone there would have iOS devices (since all of them were iOS devs) and I really liked to work with iBeacon. Decide what to do was easy, because the bride throwing the bouquet is the only action during the wedding that everyone participates (besides throwing the rice in the end or maybe interrupting the wedding like in the movies).

When I started to think about the app I had 3 requirements:

  1. It shouldn’t ask the user to create an account, you need to be able to download it and use right away, simple and easy
  2. It shouldn’t need internet connection, most part of my guests were not from US and wouldn’t have internet there
  3. It should be fun, for the bride and for the guests

I also wanted it to be just one app, that you could choose between being the bride or the guest (the default option).

My first idea was something simple, the bride would start advertising a number as a major and the guests (that were ranging that specific CLBeaconRegion) would show if they were the chosen one or not. But soon I realised that I had a problem, how the bride would know how many guests are there to make the selection and how the guests would know which ID were assigned to them? That’s when I decided that the guests would have to advertise their ID also and the bride would have to range for this other CLBeaconRegion. So now both are ranging and adversiting at the same time. This is something I’ve tested on iOS 7 / iOS 8 and never worked well… but looks like now is working perfectly :)

Ok, now the guest knows that the bride is there, the bride knows how many guests are present, but I still had a problem: How would I decide which ID to use for each guest since they do not comunicate to each other? Only if we had a way to define a unique identifier for each user… and we do! Since iOS 6 we have something called identifierForVendor, that is basically a unique identifier for that specific device across apps from a single vendor. Since this is an UUID and I needed an UInt16 to use as a major, I decided to use the number of bytes of this property as my identifier.

Wrapping up, bride would start advertising a region with major zero and start ranging beacons for the guest region. The guests would start advertising their unique IDs as their majors and start ranging the bride region. When the bride shaked the device to "throw" the bouquet, it would select randomly one of the guests beacons and start advertising the selected ID as it’s major. This way the guests would know which one was the winner (if your ID is equal to the bride’s major) and which one was the loser.

Other little thing I also implemented with iBeacon was a local notification when you enter a bride’s region. So when it’s time for the bride toss the bouquet, she opens the app and all the guests would receive this message:

Hurry!!

Remember that I said that the app should be fun? This is the screen when you are the lucky one who have got the bouquet:

When I showed the app working to my wife, the first thing she asked was: "How can I, as the bride, see which one won?". The winner will probably jump/scream/etc… but it wouldn’t be awesome if everyone discovered "at the same time" who the winner was? Took me 2 days until I figured out, let’s use the flashlight! Even being "behind" the screen, everyone would be able to identity really easily who the winner was!

Now it’s time to put all this to the test and here is a video from my wedding :D

If you want to test the app, here is the link to the App Store:

Bouquet - A New Wedding Experience! on the App Store_Read reviews, compare customer ratings, see screenshots, and learn more about Bouquet - A New Wedding Experience!…_itunes.apple.com

and if you are interested to see how I did it, here’s a link to the source code:

GitHub - mauriciomeirelles/Bouquet: Bouquet example using iBeaconsBouquet example using iBeaconsgithub.com

I still think iBeacon is an awesome technology that people are not using in its full potential. Falling on the pitfall that this is just useful for marketing and museums is really easy, but when you try to be creative, you realise that having location awareness in your app is really powerful!I hope that this helps and motivate people on using this for even more different stuff!


Published by HackerNoon on 2017/02/18