I am creating an android app to detect the nearest petrol pumps. Can anybody help about how I should go about this?
1 Answers
You're going to want to look into geolocation to retrieve longitude/latitude based on where you are, and records you hold in a database (either on the device or online, read by the device at run time). You'll need geocoding on your database in order to convert physical addresses to lng/lat. This assumes you have a database of pump locations.
Some links on geolocation: Android GEO Location Tutorial
Geocoding: http://www.wikihow.com/Geocode-an-Address-in-Google-Maps-Javascript
Finally, you'll want to display pumps within a certain radius, which is mathematical: http://andrew.hedges.name/experiments/haversine/
If you're using MySQL to do this, use this query and modify for your needs: Fastest Way to Find Distance Between Two Lat/Long Points
That should give you the basics of what you'll need to implement. To get it all working together in theory shouldn't be too difficult, as identifying pumps in your database will be a case of supplying the lng/lat of current location, plus distance and pulling out/displaying results.