Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Simple way to make a geofence?

I'm new to Android development and am creating an app that allows a User to create a Geo fence around a specific location for reminders. For example: Making a geofence around a grocery store to remind the user as he enters to pick up Orange Juice.

Does anyone know of a tutorial that could help in developing something like this?

like image 460
thedeepfield Avatar asked Aug 19 '12 18:08

thedeepfield


People also ask

Can you geofence without an app?

An app – very important to note that geofences for 99,9% of the use cases cannot be used without an app. There are some minor exceptions, but most likely, if you are reading this blog post, you will need an application – whether your own or through a partner – that can be utilized for this purpose.


1 Answers

AFAIK there are no tutorials for geofencing, but it's pretty simple (assuming you want a circular fence).

  • This tutorial will tell you how to get the user's location
  • Any of these links will show you how to calculate the distance between their current location and the centerpoint for their fence
  • Calculate their distance from the center at regular intervals. I'd let them set the interval through a settings screen and start with a default around five minutes because anything more than that is a hefty battery drain. Store that distance every time you get it.
  • If their last distance compared to their new distance crosses the boundary, perform your action. For instance, I worked on an app that would alert a parent if the child left a friend's house or arrived at school.
like image 72
Ginger McMurray Avatar answered Sep 27 '22 19:09

Ginger McMurray