Plastic is undoubtedly bad for the environment. It fills landfills, pollutes the oceans, and devastates ecosystems. And while demonizing plastic is pretty easy to do, you have to admit, plastic is extremely useful. Plastic is cheap and durable, and so it's a real shame to see so much of it wasting away in landfills. Of course, you could donate your plastic products to a charity, but once you do so you'll just buy more plastic. And besides most donated products are thrown away. What I want to do is create a net-zero shopping market. A place where you can shop for goods with goods. A place like this wouldn't just reduce the amount of plastic in landfills it would also reduce the demand for plastic overall. Now obviously I can't focus on all plastic products, and so I decided to focus on the worst of the worst: toys. 80% of all toys end up in landfills, incinerators or the ocean; and of those toys, almost all of them are still "playable". If every kid in the world stopped buying toys and instead decided to trade with each other using then 33 million tons of plastic would be saved. But software like this wouldn't just help the planet, it could also help low-income families. Instead of having to buy new toys, these families could instead trade their existing toys for new ones. In essence, I was inspired to create this product to help the planet and low-income families.
What it does
ToySwap is an online shopping platform where you can buy goods with goods. ToySwap allows users to put their items up on a global market where others can trade with them. ToySwap doesn’t rely on a delivery system to function, instead, users can arrange spots to meet and trade within the app itself.
How I built it
The app was built using Android Studio. The app uses Firebase Authentication to store and authenticate users, Firebase Firestore to store user information, Firebase Realtime Database to store information about the items on the market and Firebase Storage to store media files. In order to auto-populate item information based on a photograph, the app uses Google Cloud’s Image Labeling API. The Map View was created using Google Cloud’s Map SDK. The address textbox that auto-filled was made possible with Google Cloud’s Places API and I loaded images from Firebase Storage onto the device memory using Picasso and Glide.
Challenges I ran into
This was without a doubt one of the most challenging projects that I have ever done for a hackathon. I remember thinking halfway through the first day that I had bit off way more than I could chew, and I almost quit. Listed below are some of the challenges that I faced:
I’m not much of a front-end guy. Stepping out of my comfort zone and designing every bit of UI for my app was a huge challenge for me. In total ToySwap had three separate activities (or screens), four separate popups, and two different fragments (which slotted into a View Pager on the third activity). I spent a lot of time designing each piece of the UI, the Login Animation, for example, took a half-hour to finish.
Integrating Google Maps into my app was probably the biggest challenge I faced, which might seem strange, considering the Map View appears only once throughout the entire app. Because I was launching my app from a Fragment, using the MapFragment (as a lot of online tutorials suggested) simply did not work. I instead had to use a MapView. While this might seem simple enough, it took a lot of research for me to overcome this challenge.
Once I uploaded the images to Firebase Storage finding a way to retrieve them was a challenge. At first I downloaded the images once the data changed and then displayed them. However this was a bad solution, and I was not really satisfied with it. After searching for a better solution for a considerable amount of time I discovered Picasso, which allowed me to load an image onto an ImageView provided I had a downloadable link.
Accomplishments that I'm proud of
I am incredibly proud of myself for finishing a project of this caliber in such a short time. As I stated before, this was the biggest project I had ever done for a Hackathon, and the fact that I was able to finish it in such a short amount of time is something I am incredibly proud of.
What I learned
I learned how to use Fragments in Android Studio. I also learned how to use Glide and Picasso to load images from Firebase Storage. I also learned how to use Google Cloud’s Image Labeling API.
What's next for ToySwap
In the future, I plan to create an in-app messaging tool where the trader can communicate with the owner.