Android - Alarma en la ubicación

Theoretic question. In my app I need to create alarm at location functionality. So user can pick location, set alarm and any time while She/He will get closer to location alarm will trigger.

I know that I have to create Service to listen the current location. It is obvious that I can't use GPS.

Any ideas how to figure it out if device is close to location? I know that I still have Network location, which probably I will use, but I afraid of that this will consume to much energy.

If there is any internal android system service which provide such data? That I can just setup receiver.

Any ideas are welcome ;)

preguntado el 25 de septiembre de 13 a las 10:09

Why can't you use GPS ? -

I don't want to waste battery life for periodically location check by using GPS. -

"any internal android system service" - Google Play SDK. Available on devices with Google Maps. -

2 Respuestas

I suggest building on Google Play Services in order to get the product working quickly. Of course if you need to target non-Google phones, then program this manually, but only if you have to.

Play offers Geofencing apis - here are the docs:


PROS:

  • Google is constantly updating the Play sdk to optimise the features.
  • quick to get it working
  • eficiencia de la batería

CONS:

  • it will not work on non-Google API devices, i.e. Kindle Fire

Upshot of all this:

  • if your app relies on Google Maps at all, then use the Play Geofencing.

Respondido el 27 de Septiembre de 13 a las 13:09

I decided to use ProximityAlarm in Service. Great example from this post:

La alerta de proximidad GPS de Android no funciona

contestado el 23 de mayo de 17 a las 11:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.