Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do something when phone reaches a set of location?

I have a list of coordinates in the database identified as POI. For a city could be >100 records.

I would like to get notified when the phone gets in 150 meters range of one of the location. The location coordinates too has an error/radius, usually 10 to 100meters. Since I don't find it good to add each location(could be hundreds) for a trigger, how can I optimize the wake-up code?

Also do I have options to remove a previously setup notification from the queue?

like image 833
Pentium10 Avatar asked Nov 06 '22 12:11

Pentium10


1 Answers

You could store your POIs in some sort of intelligent Hash-Table using the coordinates to compute a unique hash. Each time a location update arrives you make a lookup in your hash-table to see if there are POIs near the current location. This lookup should only take O(1), since it is a hash-lookup.

The desired range should be taken into account when computing the hashes and storing the POIs.

Just an idea!

Kind regards, mefiX

like image 200
mefiX Avatar answered Nov 09 '22 23:11

mefiX