Google Maps startActivityForResult - android

I would like to start a Maps activity and get back a location result. Is this doable without using a MapView and having to require the google maps library?

Yes it is possible.
you should add "onclick" event listener to your map. It will return coords when event is fired.
Please find more details in map API documentation. http://code.google.com/apis/maps/documentation/javascript/events.html

You know the Geo position / name of the location. You can get the location information using Google Maps Web Service API.
Pleas look into the following link for details. http://code.google.com/apis/maps/documentation/webservices/
If you are sure about getting location information from Map Acitivity, You cant achieve it without using MapView.
PS: Other Suggestion is You can have it a static map and respective location matrix if the map area is well defined.

Related

Directions API Live tracking in android app

I am trying to use google maps directions API with continuous hitting to the API and updating the directions by getting a current location on location changed listener and it works perfectly.
But Instead of hitting multiple times I need to get directions API for the single instance and write an algorithm by getting the directions using segments start point and update on google map, Find a way to know the user is traveling in the wrong distance and re-route map by calling API.I tried these ways and working but there are a lot of cases to be handled for these scenarios.
I don't understand what to follow and why this is required is, we have a display cycle and the user starts the navigation and directions should be shown on cycle hardware display via BLE.
Please help me solving this issue.
You can try using the Google Maps Util Library. The PolyUtils class has methods to check if a LatLng lies on a polygon/polyline.
Maybe try using the method isLocationOnPath. And if it's outside the polyline, make the request to directions API and re-plot the route.
Docs: http://googlemaps.github.io/android-maps-utils/javadoc/

Point google support map fragment based on Location name given in android

I am using google support fragment map and instead of Latitude and Longitude I want to show the map pointing towards a location that I give when the map becomes ready in the method OnMapReady(GoogleMap map).
How to achieve this?
With that information, we cannot really understand your problem. But, if you want to know how the OnMapReady(GoogleMap) will work, then this documentation can help you with that.
It explains here the basic step that you need to construct a map.
Follow the steps in the project configuration guide to get the API, obtain a key and add the required attributes to your Android manifest.
Add a Fragment object to the Activity that will handle the map. The easiest way to do this is to add a <fragment> element to the layout file for the Activity.
Implement the OnMapReadyCallback interface and use the onMapReady(GoogleMap) callback method to get a handle to the GoogleMap object. The GoogleMap object is the internal representation of the map itself. To set the view options for a map, you modify its GoogleMap object.
Call getMapAsync() on the fragment to register the callback.
For more information just check the documentation link above.
Now for the Geolocation that you want, this tutorials can guide you on how to do that.
Locating user input address in Google Maps Android api v2 with Geocoding api
Android Geocoding – Showing User Input Location on Google Map Android API V2

Show empty[no country/city] continental based map & on touch get cliked latitude,longitude

I'm developing an app in Android that shows an empty map [without country/city or any information]. How can I achieve that using MapView?
I found a solution using static map, but can I get touched latitude, longitude in that, as static map returns image?
Need to achieve following kind of : http://maps.google.com/maps/api/staticmap?sensor=false&size=512x512&center=london&zoom=6&style=feature:all|element:labels|visibility:off
But I need this to be in MapView so that I can get touched location & perform operation on that.
Any help or hint are appreciated.
You could download the google maps sample code. In it you can easily see how it's done.
Don't forget to create a API Key from a debug certificate fingerprint.

android location listener two functions Google Maps

I am working on an app that runs a service that has a location listener, and needs to do things in the background.
I am currently integrating Google Maps in my app, do I need to create a different location listener? Do I use the same one, how?
If someone can point me in the right direction for the right way to do it, I would greatly appreciate it...
If you are using google maps v2 just set setMyLocationEnabled(boolean) to true and it will display your location without you having to do anything
In your location Listener, wherever you get your location, you use the googleMaps change position method call.
googleMap.moveCamera(CameraUpdateFactory.newLatLng(position));
position would be instantiated like so:
LatLng position = new LatLng(location.getLatitude(), location.getLongitude());
That should do what you want it to do. Spend some time looking at the developer guide for google maps.

How to make places in Google Maps to be objects like maps.google.com with Google Maps API in Android?

When using maps.google.com, places like parks,bus stations, restaurants are objects and we can mouse-hover to display the place's detail. See image : http://i.stack.imgur.com/xfRDo.png
But we can't do that with only Google Maps API. See image : http://i.stack.imgur.com/SU9uC.png
Thank in advance !
ps1 : The default Maps application in Andoird also has this feature.
You are welcome to use an Overlay, or override onTouchEvent() in a custom subclass of MapView, to find out when the user taps the screen. You are welcome to use a Projection to determine the latitude and longitude of where the user tapped. You are welcome to pass that data to some Web service that can tell you what is at that location. And you are welcome to display those results in some form (e.g., Toast).
However, none of that is built into the Google Maps SDK add-on for Android.

Categories

Resources