I have searched for hours on the web for an example of implementing the direccions service on my android app.
I am using the google maps android api 2.
Basically I want the directions from the actual position and a marker position selected by the user.
I want to make clear that I don´t want to launch a web browser or the google maps aplication, I want to implement the service on my own app.
Till now I found some examples about drawing the route on tha map, which are ok
http://wptrafficanalyzer.in/blog/gps-and-google-map-in-android-applications-series/
Get driving directions using Google Maps API v2
so I just miss the indications part of the service so y can show on my own listview with arrows (turn to left , to right , etc).
Thanks for reading my question
I'm not sure what you want. In your second link about Google Map API v2, the data for drawing maps comes from maps.googleapis.com .You can see https://developers.google.com/maps/documentation/directions/ for more documentation about that.
The xml returned from maps.googleapis.com include <html_instructions> tag which contains instruction like turn left or turn right. So you just need to parse that xml and use <html_instructions> tag for information you need on your listview.
I hope this helps.
Related
Hello my name is James,
I am self-learning how to develop android applications, I have designed few basic apps – to name a few calculator app, notepad, percentage calculator for android. After developing few small basic apps, I am planning on making more advance apps, I am planning on creating an app that allows the user to tag their location on google map or geotag images using the application, which will only be visible to them. For example, the user can tag location to a map and later on get directions to that location or take an image of a location and geotag it to the map and add some sort of description to it.
I have been searching on google for some time now, on how I can go about designing this app but I haven’t really found any tutorial / guides how to implement the image geotagging / location tagging to google map.
Please can someone give me some guide, something to read upon or maybe correct me if am not searching for the right materials.
So far, I have carried out searches including:
How to add google maps to my android application (I found a good guide for this and I understand how I can do this)
How to implement geotagging on your android application (Haven’t found any useful material apart from few applications released on play store)
How to implement location tagging (Haven’t found any useful material for this either)
I found a video on YouTube where the person has designed a similar app that I am planning on doing http://www.youtube.com/watch?v=_V49bXXtnvU but other than I have only come across videos / guides that shows how to add google maps to your android application something like http://www.youtube.com/watch?v=awX5T-EwLPc
Thanks for your time.
I'm not sure if you found your answers already, but in case you or someone else is still looking:
- http://www.vogella.com/tutorials/AndroidGoogleMaps/article.html
I found that tutorial helpful in getting started with MapsActivity. If you are using Android Studio then just start a new project with the main activity selected as Map activity. This will start you off with a lot of the necessary code for starting the Google Maps API. It will walk you through how to get your google api key for your app.
Once you have that set up, then look at the several listeners that are available for the map. Some that you may want are Map.setOnMapLongClickListener, Map.setOnMarkerClickListener, Map.setOnMarkerDragListener. These will help you decide what to do with locations on the map.
Look at the Marker class to be used Google Map. You will set your tags/markers with this class. You can replace the default marker with your image if you like or create your own custom tag. https://developers.google.com/android/reference/com/google/android/gms/maps/model/Marker?hl=en
You can use LocationManager to get your current location. Here is a simple tutorial: http://javapapers.com/android/get-current-location-in-android/
If you plan on providing Camera within your app or get images from gallery, you should review the Camera Class :
http://developer.android.com/guide/topics/media/camera.html
and a simple tutorial:
http://www.tutorialspoint.com/android/android_camera.htm
I would add one feature at a time when starting your app project.
Create the map with working key and make sure it displays a map.
Then, add a marker on your current location (on an emulator, you will have to set the default location because it will not have gps).
Then, allow the user to add a marker by i.e long pressing on a map location.
Then, open a dialog box of choices when long pressing on map, i.e tag location, tag with custom tag, tag with camera image, etc.
Scenario :
In my android app, I have a Google Map that is showing me my friend's location. My friend and I can move from their position and I still want to get him (finding friend's location/updated_location is not an issue). To reach him fast, I am implementing navigation functionality to it.
Question :
How can I implement navigation to Google Map? I heard about OpenTripPlanner, but I'm not sure if I can use it in Google Maps.
As my friend's and my location can change, I want to update the navigation path from my current location to his current location. (An Idea I have is to recalculate the path when friend's location changes).
I also want to implement voice navigation to my app. How can I get this?
Any suggestion which will satisfy above requirement will be appreciated.
Please suggest sample code and working functions that can be used.
You can take a look at this blog post I wrote on implementing a navigation Polyline to your Google Maps API V2:
Google Maps API V2 Polyline Navigation
There you will find the needed method to get the navigation instruction from Google Directions API and to paint it on your map.
Can i get direction between 2 points with using Google Maps v2 in my Android application ?
I found Polyline but i don't want to draw a line between 2 points.
I found a solution which is using Intent. It can solve this problem but it is not useful because this solution is starting another map application and I want to show direction in my application. Can i do this ?
You cannot get directions using just the Google Maps V2 api. You should use the Google Directions API direction request call. This will return the raw direction data in json which would allow you to draw a Polyline for the directions on the map or show the data in any format you would like.
There isn't any method to do it because it envolves several computing that must be done in Google Maps servers (and they don't allow you to do so many without paying if you hold a business).
So, the only way is making a petition to google maps servers as they describe in the Google Maps Api documentation that #Bobbake4 linked. Then, you'll receive several coordinates that you'll use to draw a polyline which represents your route.
Hopefully, someone has already coded everything and shared gently with us here https://stackoverflow.com/a/15643705/1516973
That's absolutely the best answer covering Android Google Maps routing that I've found in Stack Overflow, so thanks to #Akexorcist and #emil-adz for it.
Im using the latest Google Map API. What I would like to do is that I have an image of plan of a building. I would like to put this on the correct location and display this image instead of the normal map. It would kinda be like if you zoom in alot on a train station and you get more details.
Is there any way to do this?
There is an example with the official Google Maps for Android API sample code (installation how-to) called GroundOverlayDemoActivity.java.
You could try this and check if it is a starting point for further investigations.
Here is a screenshot of this activity:
I am using android 2.9 or something for my project.
Now the project is an image button on the main activity and when a user clicks on it, the user will see a google static map.
Problem is, each tutorial I have seen until now uses GOOGLE MAP API in the project, which I think is not possible for me, as am using android 2.9, not Google APIs,
and I don't know how to add as it just gives option for one only.
So is it possible to show just a static map without using google maps in ones application?
thanks a lot.
yes thats quite possible but in that case you will only get a static image without zoom in/out options... u can also add markers on it...
just send a Http request with/without your markers to http://code.google.com/apis/maps/documentation/staticmaps/
save the reply in a file and that would be the map.
I'm not sure I understand your question completely - but Google Static Maps API is simply a web-service.
Ie - you hit a URL, where the parameters describe what map you are after and you are returned (by HTTP) an image of the map rendered for use in your application.
Check out the Static Maps documentation. There are plenty of examples. You'll see you don't need to use any API in your project at all, you just need to construct a URL that describes the map you would like and catch the response!
Edit:
Here is a simple example of a URL your app could generate:
http://maps.google.com/maps/api/staticmap?center=London,%20England&zoom=14&size=512x512&maptype=roadmap&sensor=false
URL parameters pass in values to the web service to describe the map you would like to generate.
The URL above generates a map centered on London, England. The zoom level is set to 14 (higher numbers = a closer zoom), and the map is 512x512 pixels. If you look in the static Maps API documentation, you'll see there are many many other options you can pass into the service place markers and annotations on the map.
I hope this helps!
N