2

I know that there is a technique to update more than 100 geofence to google api client. But I want a complete solution to add more than 100 geofence or any library to achieve it. I already done my project using google api client. But there is limitation off 100 geofence only.

Is there any library or any other technique to update more than 100 geofence?

And all these process should run in background. I mean even after application process is killed, this should run in background. Is it possible?

Thanks in advance.

  • Possible duplicate of [Android - Need to add more than 100 geofences](http://stackoverflow.com/questions/29670504/android-need-to-add-more-than-100-geofences) – CaptainBli Jul 28 '16 at 19:14
  • Yeah.. i followed that one.. and i got output.. but the thing is that i have to run everything in background service.. i mean even if application process is killed, the above process should run in background.. would u suggest any idea for it?? @CaptainBli – Balaje Venkat Jul 30 '16 at 07:13
  • Sorry, not more than the other post. Though I'll +1. – CaptainBli Aug 03 '16 at 21:01
  • I just saw the edit. What do you mean after the application process is killed? Are you talking about if the app has been forced stopped, or if the app has been killed by the user using the task manager? – Pablo Baxter Aug 04 '16 at 17:58
  • After killing the application from task manager or swiping from recently opened app.. @Pablo Baxter – Balaje Venkat Aug 05 '16 at 04:20
  • If you are registering the geofences in an activity, then they could be destroyed when you kill the task. If you register them with a Service, they should remain. I would play with it a bit to verify. Otherwise, try a Service in a separate process or the service as a foreground service. Those options should work. – Pablo Baxter Aug 05 '16 at 17:16
  • Yeah. got it @Pablo Baxter. I tried to initialize it in application class. It is working fine. Thank you. – Balaje Venkat Aug 06 '16 at 04:44

1 Answers1

2

The issue with having more than 100 geofences is that depending on how close they are in proximity to the user and how many geofences you actually have, it can become a serious battery drain due to constant location polling. I'm not sure how you plan to implement your geofences, but I would suggest you look into loading only geofences within your immediate and surrounding area, storing the rest into a database, and loading/unloading depending on your current location and distance from the edge of the geofences. Bing came up with this nice tiling system that may come in handy for you.

Pablo Baxter
  • 2,144
  • 1
  • 17
  • 36
  • Your suggestion is correct. I implemented my code to take only nearer value by using Haversine formula. Its the only way. But its draining battery too fast. Thank you for your answer. – Balaje Venkat Jul 21 '16 at 08:31
  • Put a passive listener into your app, and see how often wifi/gps calls are being made. If it is you initiating the calls, make sure you remove the updates, since they hold a wakelock, which can contribute to the battery drain. Just verify that network location calls are made at most once every 30 seconds, with gps being at most every minute. This lets the phone sleep between updates, thus saving power in the long run. – Pablo Baxter Jul 21 '16 at 18:23