I am using the Here map api to show the here map in android fragment. I am successful in showing the here map in fragment. But i cannot able to show "My Location" button on left corner of here map. (I am using the premium plan)
So, How do I show my location button on a Here Map?
For google map api, we can add "My current location" button like
explained in
(How to display my location on Google Maps for Android API v2).
I am looking for the same functionality using Here api.
There is no built-in location button UI for the HERE SDK as there is for the Google SDK. You will have to implement the button UI yourself and have it call Map#setCenter(GeoCoordinate point, Animation animation) [1] when pressed. You can get the current location to hand to setCenter using the PositioningManager#getPosition() API [2].
[1] Map setCenter API Reference
[2] Positioning User Guide and PositioningManager API Reference
Related
i working with google map directions api in android application.when i send two Location to google api it return route between both but LatLng is changing and no one send me.Is there a way to do this?
You have to implement LocationListener to locate user's device GeoCode.
That will take some effort. You could refer the demo I made here mClima
The listener for location change was implemented in MainActivity. Remember to declare permision in AndroidManifest
I am trying to trigger a marker click (or other map events too) programmatically in Google maps API for android V2.
Does anyone have an idea as to how to do it ?
Apparently javascript api (v3) , has a trigger function but I could'nt find anything for android.
Thanks for the help.
You cannot triger a marker click directly.
If you need to run default implementation when onMarkerClick returns false (or you have no OnMarkerClickListener), you need to do it yourself:
marker.showInfoWindow();
map.animateCamera(CameraUpdateFactory.newLatLng(marker.getPosition()), 250, null);
250 is assumed here, API doesn't give you the value used internally for this default marker click behaviour.
If you have a OnMarkerClickListener, you can just keep the reference and call a function on it sending marker as a param.
There is a good tutorial for detecting a marker click on Google maps V2 here: http://android-er.blogspot.in/2013/01/google-maps-android-api-v2-example_5213.html
Hope this will helps you.
OnMapClickListener is an Interface you can use to detect clicks on Google Maps V2.
Kind of a "trigger" like in js. You set a Listener for specific events and you wait until you got some. Then you declare a method and you handle the event.
From my app I would like to start the Google Maps App with a provided location and a marker. The marker should indicate, that there is something on that given location.
For now, I have the following code, which starts with an Intent the Google Maps App with the provided location (51.49234, 7.43045).
startActivity(
new Intent(
android.content.Intent.ACTION_VIEW,
Uri.parse("geo:51.49234,7.43045")));
When the Google Maps App starts, it looks like the following:
No marker is shown. I would like, that the Google Maps App would show a marker on that position, which is given through the Intent. Is there any "hidden" Intent URI's which I can use to show a marker within the Google Maps App?
Thanks in advance.
Solution
#Rajiv M. pointed me to the idea of querying the surroundings with the given location.
So, the solution is: Query the surroundings of your given location with your given location as the parameter. The URI looks like:
geo:51.49234,7.43045?q=51.49234,7.43045
Google Maps will show the query-result as the street name:
Kind of a hack, but it seems to work well.
Why you should not use 0,0 as the map location
geo:0,0?q=51.49234,7.43045
When you start Google Maps App with the provided map location point 0,0 , Google Maps App will start searching for your current device position. And this takes time. In some cases, when GPS signal is not provided, way too much. Until then the Google Maps App will start searching for your query 51.49234,7.43045.
Try starting Google Maps using the same intent, but with a URI of the format:
geo:34.067214,-118.349332?q=410+Hauser+Boulevard,+Los+Angeles,+CA
i.e. geo:0,0?q=street+address
The application should then actually show a point at that address. If you do not have the address, you may have to use a service to translate it to an address for this to work.
-
The other option is to embed a MapView in your application and add a marker within that. A tutorial for using MapViews / Markers with-in your application can be found at http://mobiforge.com/developing/story/using-google-maps-android.
Maybe you can try to put ur uri as below:
Uri uri =Uri.parse("http://maps.google.com/maps?q=" +_lat +","+_lon);
At least the above code work for me. It help me add a pin point on top of the location i search for. furthermore, the pin point will have a small dialog box to press on, it provide me the function of searching the direction to that location. :D
i don't wanna use a MapView an some Overlays. I only want to use the given intent Google Maps. Showing a Adress in Google Maps works fine when i call it from my application using Uri.parse("geo: ...") ... But i only see the map centered at the given adress. There are no marker or "bubble" like they are when i do a search in google maps. I can define the Zoom in the Uri with "z=12" ... Is there one thing i had to set up to see the marker and the "bubble"?!
Thank you!!!
Is there one thing i had to set up to see the marker and the "bubble"?!
There is no documented and supported means to put a "marker" or "bubble" when you use a geo: URL. Bear in mind that it might not be Google Maps that winds up responding to that URL -- the user could have installed another mapping application that they choose to handle such requests.
in my app i want to show the location address, latitude and longitude and exact position of the user in the map.
i am able to find the latitude and longitude. In my app i have a button named "View Map", when the user click on it i want to show the location in a map. Is it possible to open the google maps or maps which is in present in the android devices when i click on the button, if not what is the option please help me...
You can either show a map inside your own activity as written in the previous answer's link or you can fire an intent to open the Google Maps application in your device. You can find the relevant intent here: http://developer.android.com/guide/appendix/g-app-intents.html
To start with showing Map in your Activity begin with http://developer.android.com/guide/tutorials/views/hello-mapview.html
And to show your location in attractive manner use https://github.com/jgilfelt/android-mapviewballoons