While on vacation in China, one of our team members went out for a run and found himself completely and utterly lost. He had his phone with him (no data plan) and called his family but couldn’t describe his surroundings aside from “a red sign” and “a hotel or something” because he didn’t know the language. It was an embarrassing moment that ended in a 3-hour search session. We modelled this hack to make sure that this situation won’t happen again. (Google maps works in China!)

What it does

The geographical midpoint between the two users is calculated, and a nearby establishment (restaurant, bank, library, museum, park, and many many more) is chosen as the "meeting point". This establishment minimizes the distance that both users must walk in order to meet. Once the establishment is located, a list of walking directions is sent to both user's devices to help direct them to the meeting point.

How we built it

We used Node.js for our server, and Android as our platform.

We receive the user's geographical coordinates using the phone's GPS, and send it to our server via Twilio's text messenging APIs.

We then check if the coordinates that we just received would put our new user within matching range of anyone that's already in our Firebase, and match them if they are. This pair is then sent to our pairing functions to determine the best meeting spots for them & directions to it. If they aren't matched immediately however, we place them in the database as someone who's waiting to be matched. This list is updated every 5 minutes, and the old entries are deleted. The owners of these entries are notified with a "Match not found." text when their entry is removed from the database.

All the geographical parts are built using Google Map APIs. Once the geographical coordinates of two users are located, we use Google to find a list of establishments within a certain limit from the geographical midpoint of the two users, and choose one of the establishments as the meeting ground. Once the ideal location is found, we provide directions for both users to reach the meeting point, by sending them via Twilio.

APIs used- Twilio, Firebase, Google Places Nearby, Google Dimension Matrix, Google Directions

Challenges we ran into

Working around callback hell was challenging, as we dealt with loads of requests to Twilio/Google servers, sometimes one right after another. We decided to learn and work with es6-promises to simplify the process of async functions.

What we learned

We learned how to integrate Twilio's API's with applications in order to take advantage of using cellular service over internet service. We also learned of the vast amounts of APIs and services that Google Maps offers.

MHacks Refactor, February 19-21, 2016
Made with love by

Share this project: