0

I am new to Android Development and need help desperately.

i am developing Google Map Application for Taxi Hailing. i develop Prototype that how it will work with using Peer to Peer technology.

My challange:

i can show user and Taxi Driver location on map. but i do not know how to show Taxi location on map when user start His App. I read lot of article but No result.

As i have little Idea that create a Virtual Pool on Server for Both applicaition and get Lat and Long from Taxi Location and store in Virtual Pool, from their get location and show on User's App. But no idea will it work or not.

can anyone please help me how i can Show Taxi location online on Google Map.

Manoj
  • 3
  • 2
  • What is your problem excatly? If you know the position of the taxi and there is a P2P connection established, then you can simply send any location changes and put the location on the map as a marker – cYrixmorten Oct 22 '13 at 11:54
  • Hi, Idea is to develop Taxi Apps. i have develop App for USers where i can locate users location. Now i dont know how to display All Taxi Within Area on Google Map. i am in development phase of Driver App. My plan to use WCF services for connection manager. Would be great your side help to develop Map Application. – Manoj Oct 23 '13 at 08:16

1 Answers1

0
  1. To show the users current location simply setMyLocationEnabled(true) on your GoogleMap object
  2. To get the users current location see my answer to: Location servise GPS Force closed
  3. My suggestion for storing taxi locations would be to use parse.com as the server side. Again, from the taxi (assuming you have a device there) use my implementation of GPSTracker to update the location on parse.com.
  4. Now when the user open your app let it poll parse.com for taxi locations every, say 5 seconds (only while showing map that is).
  5. In order to only show taxis that are nearby, you can use the users current location.

    If there is few taxis, it is simplest to poll all locations and let the user device select those nearby, see my answer to Android Maps v2 - animate camera to include most markers.

    Alternatively think as if you draw a square around the users position. Calculate the leftmost corner in top topleft=(lat_topleft, lon_topleft) and right corner in bottom botright=(lat_botright, lon_botright). Now you can do a search like, shown as SQL for demonstration, it is a bit different when working with parse.com:

    SELECT taxilocations FROM taxis WHERE user_lat > topleft AND userlat < botright

    Thereby only polling for taxis within the box drawn around the user.

This would be my take on it, hope it helps you.

Community
  • 1
  • 1
cYrixmorten
  • 7,110
  • 3
  • 25
  • 33
  • Hi, Thanks for your Great Help. i will try to user all steps. i also checked solution in AndroidHive. i was also using your site to check some code. 1 more question.. how i will show taxi is running on google map and show to user on Google map. Thanks for Help Ravi. – Manoj Oct 23 '13 at 11:48
  • That i am not sure. You should definitely ask the server for new position, maybe every 5 seconds as I wrote. Then as a simple solution you can clear the map and add the markers again. The more complex solution would be to take the speed into account (is in the Location object from GPSTracker) and and animate the markers to move over the map accordingly, and correcting the position each time a new location from the server is found (in this case you might need faster pooling to make it look nice) – cYrixmorten Oct 23 '13 at 12:23