I am creating an app for the iPhone using Cordova.
I am not very good with objective-c, but have written some plugins before, so I can if needed.
I have a list of locations (gps cords) for a chain of stores. I want to popup a notification whenever a user of the app is near one of the locations.
Does phonegap support this? If not, can anyone point me in the right direction about implementing this in objective-c?
Yes, it does!
First you should have a watchPosition for getting the new position of the user if it moves.
For more information of watchPosition look here:
http://docs.phonegap.com/en/2.1.0/cordova_geolocation_geolocation.md.html#geolocation.watchPosition
Then, depending of the radius of nearness of the user to the point of interest you should notificate with the popup.
EDIT
If you’re using google maps first you should initialize the map and call the function geolocalization, then with the function calculateNearLocation looks in the array of POIs if the distance is less than 1Km, for example. If it does, it alerts with vibration.
The code would be something as this using google maps:
On success of the geolocalization:
For calculating if the user’s location is near a POI: