You'd develop an Android app using tools such as Eclipse and the Android SDK and request location updates to your app via the Location API's LocationManager.requestLocationUpdates() method. GPSTest open-source app on Google Play is a good example of how this is done. Android source code is here. If you don't need fine-detailed resolution for location data, for battery life reasons I'd strongly suggest listening to the NETWORK_PROVIDER (i.e., combination of cellular and Wi-Fi location) instead of GPS for battery life reasons. Even more efficient is the PASSIVE_PROVIDER, but using this you will only get location updates when they are requested by another app, not at a fixed interval. If you're collecting data ongoing in the background, you'll need to execute this code in a Service, instead of an Activity. See this page on the Android Developers site for details and tutorials on getting location on Android.
There are two options to send data to the server:
- Bulk-upload at end of day
For #1, I would suggest creating a REST-ful API that is hosted in a web server and uploading the data encoded in JSON over HTTP.
For #2, I would strongly suggest sending data to the server using a compact format (e.g., proprietary) and an efficient protocol such as UDP. (See bottom paragraph for details why).
For #1 and #2, you need to be very careful on how often you refresh the location (e.g., Network or GPS data), and for #2 you need to be very careful on how often you send data to the server. Both GPS and wireless data transmissions have huge impact on mobile device battery life, and wireless transmissions quickly eat up the data allowances for users with tiered data plans (i.e., not unlimited). Again, use the NETWORK or PASSIVE provider if possible to avoid the heavy energy cost of GPS. Additionally, for wireless data transmissions, if they are happening frequently you really want to use an efficient protocol like UDP instead of TCP or HTTP, since UDP is much friendlier to battery life. Also, for #1, use compact formats such as JSON (or Google's Protocol Buffers) instead of XML, again for battery life and data allowance issues.
I wrapped up my dissertation on intelligent location-aware mobile platforms earlier this year, and it has a lot of field tests showing the impact of both GPS and wireless transmissions (including UDP vs. TCP, and SOAP vs. REST) on battery life and data allowances, and also has some strategies to mitigate this. Short version published in IEEE Pervasive Computing is here.
For either #1 or #2, we've hosted web apps receiving this data using the open-source Glassfish project, and have had good experiences with it. I'd recommend Netbeans for this type of server-side web application development, although you can accomplish the same in Eclipse.
You'll need to set up your Glassfish server to connect to PostGIS via JDBC drivers. Once the location data arrives at the Glassfish server, you can insert it into a PostGIS database and/or execute a spatial query to discover the items you've listed (see simplexio's answer for details). Once you have this information in your Java webapp, you can then perform any action you want from this software that you can do in a normal Java application.