Inspiration

It is too easy to forget how much sunlight us humans need each day.

A big portion of our population is vulnerable to lack of sunlight exposure. Night shift workers, dev-ops, researchers are often spending a lot of time working indoors, and risking their physical & mental health.

It is recommended to get at least 30 minutes of sunlight midday.

What it does

Users can track how much time they are spending outside during daylight. This app locally tracks the users' GPS history and analyze how much time they have spent under the sun.

How I built it

Using Android Location Update API, we log each user's GPS history on their devices.

  • Log each user's GPS history using Android Fused Location Provider API
  • Define the indoor areas (home, work, classrooms, etc.)
  • When user's GPS coordinates transitions from indoors to outdoors or vice versa, log the event and check if the event occurred during daytime. (Sunset & sunrise time calculated by GPS coordinates + timestamp)
  • Group transition events by dates then aggregate the total time spent under the sun.
  • Display the time spent under the sun to each user, and show warnings if they are exposed to too little sunlight.

Challenges I ran into

There is no readily available data for determining indoor areas (where the sun is blocked). We tried to think of a way to distinguish indoor areas from outdoors, but ended up defining each user's indoor areas manually. Most users only visit a small set of indoor areas everyday, so we don't think the compromise is too extreme.

After we determined how to figure out indoor areas, we tried to use Google's Geofence API to detect users' behavior, but Geofence API's accuracy was too low and it could only define area larger than 100m in radius as an indoor area. Most people's homes and work places are much smaller than what Geofence API could detect, so we had to find other ways to detect whether users are indoors or outdoors.

Also, calculating sunsrise & sunset time for different timezones was a challenge.

Accomplishments that I'm proud of

In the end, each user just needs to define their most frequently visited indoor areas, then the application can handle the rest. We are proud to provide a fool-proof way of measuring sunlight exposure for everyone.

What I learned

Background services are very important for this application, and we had to explore various ways to handle background tasks within Android. We learned that Android's broadcast & intent system is helpful to simplify these asynchronous tasks.

What's next for Sunlight Exposure Tracker (SET)

  • Implementing an UI for defining indoor/outdoor area would improve the user experience.
  • Amount of sunlight is significantly affected by time of the day and weather. Both factors can be calculated and improve accuracy of the report produced by this application.

Built With

Share this project:

Updates