Do something when the phone reaches a set of places?

I have a list of coordinates in a database identified as a POI. For a city, there may be> 100 entries.

I would like to receive a notification when the phone falls into a distance of 150 meters from one of the places. Location coordinates also have an error / radius, usually from 10 to 100 meters. Since I do not consider it appropriate to add each location (maybe hundreds) for the trigger, how can I optimize the wakeup code?

Also, are there any options to remove a previously defined notification from the queue?

+5
source share
3 answers

You can store your POIs in some kind of intelligent Hash-Table, using coordinates to compute a unique hash. Every time a location update arrives, you do a search in your hash table to see if there are POIs near your current location. This search should only accept O (1), since it is a hash search.

The required range should be considered when calculating hashes and storing POIs.

Just an idea!

Regards, mefiX

+2
source

There is an application called Locale that can switch various events based on your GPS location or available Wi-Fi network or CSID, etc.

It also has a plugin interface. You may find it useful to study this application and perhaps write a plugin for it.

0
source

This problem reminds me of graphics in video games. There is no need to load points that are outside of your range of motion. I broke the map into the grid, set triggers for 8 blocks of adjacent grids, and then for each of the POIs in the current grid block. When a new grid block is reached, the triggers are updated. It would probably be wise to overlap the grid blocks given the range of errors.

0
source

All Articles