Sharing google map V2 with polyline drawn on the map (Reusable) - android

Hi, I am new here. So if I have posted my question in the wrong place or any mistake, please do enlighten me. I have more or less browse through many sites searching for an answer but I could not find anything.
Let me briefly explain about how my Android apps will work:
1. There's one part of my apps, it will track the location of the user via Wi-Fi and GPS.
2. It tracks the distance traveled, speed, time taken and etc.
3. Now I planned to add in another feature in, which is:
-> I want to share the route with the map which the user has ran through to Social networks where another user can press into it and the apps will automatically receive the route and map which previously ran by the first user so that he/she can challenge the first user by running the same route as the first one's route (guided by the polylines drawn on the map). Then the apps will be able to track the second user, and a New polyline will be drawn on the route to track his/her progress. (distance traveled, duration and polyline drawn on the Google map)
Ques: How am I suppose to share the map together with polylines which are accessible by others.

I guess you'll have a server side for this as well, so if a user runs, the result will be uploaded to it. You should generate a unique ID for every run like this, and store it connected to the data needed to be stored (distance, speed, etc), and only share a URL from your app, and let the server handle the rest.

Related

Maps on android drop a pin

I need to show google map to user and then resolve the address on that map.
I wonder what's the recommended approach for best user experience in Android?
The ways I was thinking of is:
Show current location (or default if not permitted). Put a pin at the place where user taps on the map. If tapped again, then just move the pin. Resolve the address where last pin was dropped
Another approach is same to what uber has: show the map with a pin in the center of the viewport pointing to current location. That pin is still in the center and consumes new position when map is moved against it. Address is resolved when map movement stop event received
Disadvantages of #1 is that it might be not obvious for user that pin needs to be placed on the map
Is there a best practice for this? Or a more intuitive way to do this?
Any suggestions?
These tasks need Google Cloud Api And That is paid.
Reference Links:- https://developers.google.com/maps/documentation/android-sdk/overview
https://console.cloud.google.com/apis/library/places-backend.googleapis.com?project=my-application-359006

How do I plan a users routing in chronological order?

STILL DESPERATELY LOOKING FOR ANSWERS
I have integrated Google Map's dynamic geocoding in my android project(when the user types an address, it goes there and places a marker). My plan however is to let someone else plan the users schedule for the day.
For example, someones mother wants her son(the user) to do some errands for her. So she opens the app on her phone and types in the places she wants her son to go. The son get the places he needs to go in a chronological order, i.e, the vacuum cleaner store, the hardware depot and then the supermarket. First, the route to the vacuum cleaner store(from his current location) shows up. He goes there, an then presses "done". Then the route from his location to the hardware depot is shown,and so on and so forth.
Not necessary, but appreciated: He should be able to open a navigation drawer with all the errands in a list format, from the first errand to the last.
To summarize, how do I plan someones route in chronological order? I know I am asking for a lot, but if anyone could help me out, that would be great. I would literally sing your praises.
Thanks for reading this wall of text!
It is just an idea, maybe you can try to use waypoints under the Google Maps Directions API.
You can use this waypoints to calculate the routes through additional location.
Here is an example request using waypoints in Direction API
https://maps.googleapis.com/maps/api/directions/json?origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&key=YOUR_API_KEY
You can supply one or more locations separated by the pipe character (|), in the form of an address, latitude/longitude coordinates, or a place ID.
Although this is in JavaScript, this is an example on how to use waypoints.

Tracking a users position and showing it on the map for all other users - Android

I was searching for hours, but I can't find an answer on this topic. I have managed to set up an application which shows my position, tracks it and updates my marker whenever my position changes.
I would like to do the same for all other users (for finding friends), but I don't understand the right way this has to be done.
Should I upload each users Lat and Lng to a server, then downloading it while placing markers on the map? This way I may not get fast location updates, or does the Google Map Api contain some tools to achieve this in the right way?
I would really appreciate some help.
E.
UPDATE
After doing some more resources, I realised that an online database is the way to go for this task.
Steps I made to read save and retrieve users positions:
Create an online (mysql) database
in my android project I have implemented: GooglePlayServicesClient.ConnectionCallbacks,GooglePlayServicesClient.OnConnectionFailedListener. But most important is LocationListener - to receive the current location coordinates each time the user changes position.
I then uploaded the coordinates using the HttpUrlConnection via POST method, and adding them to the database using php.
back in the app I create a new instance of the GoogleMap class, and the same way as I have uploaded I download all other users coordinates via HttpUrlConnection, iterate over the JSON response and placing markers on the map in the same time.
Everything works like it should, there may be other ways but I think this is the most straight forward solution. Hope this small guide will help.

Select Map marker with reticle in android MapView?

My application requires that a user select a location on a MapView. I will be using Google Places API to place location markers on the map. There will be times however when a user might select a location, for example a fountain in a park, that IS NOT listed in the Places API. One option is to offer users a choice of selecting a location with a touch on a map, OR selecting map markers of known locations using two different maps for each activity. I think the perfect solution however would be to use one MapView that contains the mapmarkers but also allow the user to select a location that does not have an associated marker.
My thoughts were to apply a reticle in it's own Overlay that stays centered in the middle of the MapView despite scrolling and a select button to make the selection.
If the reticle is over a marker, for example, Sams Cafe', then the button would read "Select Sam's Cafe'", if the reticle isn't over any Map Markers, then the button would read "Select this location".
I am having trouble figuring out a way to verify the reticle is over a marker. Since the marker is limited to a single GeoPoint, it's going to be very difficult, frustrating and time consuming for the user to try and match the reticle center to the exact GeoPoint.
What would be optimal is a check to see if the reticle is over the Map Marker graphic. I presume this will utilize projections and bounds??
Two questions, How to do this if possible?
or, is there a better UI that I am overlooking that is much easier to achieve?
Thank you for your consideration.
If you use the way you saying is better than anyone, but why dont you keep away any user from any kind of geocoding. Like user selects the location through marker, on the basis of that user will confirm the location, if it has got any place then it will show the address or it will show the nearby location. e.g. let the user select the location from marker get the longs. and lats. , If user confirms that location then put it onto geocoding and get the location address, it will surely return an address maybe exact or nearby and if user likes it, user will confirm it, simple. Please notify if its not feasible way.

How can I take a text query, and get a location in Android?

I was wondering how I can channel or simulate Google Maps just in the sense of a user types in a location in text, such as a restaurant name and a city name. Then Google suggests 5 or so places they have indexed, and presumably they know the GPS coordinates because Google then puts them on a map. I want to be able to use that feature- not the map, just getting the location.
My goal is for a user to type in a query, 5 options or so to be shown, and if they user chooses one of them, then the GPS coordinates, or a location object, is saved representing that place.
Ideally I could just send the query to Google and steal the results back to my app. Obviously building my own database of locations and an algorithm to suggest them is out of the question.
Thanks for the help and advice in advanced!
Note 1: To clarify, this does NOT involve the current position of the user/device.
Note 2: I looked at the Google Maps add-on API, but it looks like that is for a visual map, not the querying a location part. You are already supposed to know your location, and it will map it.
Use geocoder.getFromLocationName, you get back a list of Address objects, in those objects you will find all the information you need about the location.
To test this on the simulator you need an image with the Google APIs included. In a device should be fine if you have the market installed.

Categories

Resources