lazerwalker / cortado

Caffeine tracking for everyone
MIT License
169 stars 29 forks source link

Location prompt questions! #1

Closed nickoneill closed 9 years ago

nickoneill commented 9 years ago

Hi there, this looks awesome! Congrats on the release and open source!

You talk a bit about the power of prompting the user when they're near a location so I'm curious about your experience with your setup. It looks like you're fetching venues around the user with the coffee category (not starbucks!), then setting local notifications for those coordinates.

How frequently do you refetch nearby coffee shops? Local notifications for coordinates are subject to limitations for how many geofences can be active at once. What's your thinking behind managing how many of these are active at any time?

lazerwalker commented 9 years ago

Hi!

I'm using Apple's Visit Detection API, rather than geofences (check out the API documentation for CLVisit if you're not familiar with it). Instead of manually managing geofences, I just let the system tell me when the user has been at their current location for a decent period of time, and then I check if that location happens to be a coffee shop.

See: https://github.com/lazerwalker/cortado/blob/master/Cortado/Interfaces/LocationFetcher.m#L44-L55, https://github.com/lazerwalker/cortado/blob/master/Cortado/Interfaces/LocationDetector.m#L28-L45

nickoneill commented 9 years ago

Awesome, thanks for the clarification!