In my android app, I plan to let the user pick a location and compute the distance from his current location. So to pick this location, I wanted to give a similar interface like the google maps website, where he searches for an approximate location and then picks the exact location from the map.
Ideally, I would like to launch the google maps application, let the user pick the location and obtain the geo-coordinates back in my app. Is there any way to do this?
If not, Could I achieve this by launching a webview? Is there a way to communicate the location picked from within the webview back to my launch Activity?
The class Geocoder has a method getFromLocationName which gives some results, but they are not as good as the google maps suggestions. So trying to build an equivalent interface as the google maps application does not seem possible.
Thank you for your time.
Ideally, I would like to launch the google maps application, let the user pick the location and obtain the geo-coordinates back in my app. Is there any way to do this?
No, sorry.
If not, Could I achieve this by launching a webview? Is there a way to communicate the location picked from within the webview back to my launch Activity?
You can inject your own Java objects into the WebView using addJavascriptInterface(). If you can arrange to get control in JavaScript when the user taps on a point, your JavaScript can invoke that Java object.
Related
I want to open the default google maps application from my application, let the user pin a location, and get the pinned location details back to my application.
somekind of startActivityForResult(), where the result data would be a latitude,longitude or anything like that.
is there a way to do this? is it possible?
PS: I already know/worked with the maps sdk, but in this application this is the only use case with maps, that's why i can't afford using the sdk.
No, you can't do that with the Google Maps app. Here's a PlacePicker library that accomplishes this task though:
https://github.com/suchoX/PlacePicker
I am going to implement functionality to input current location (with out using GPS) for particular path. Following are the two options.
Since I know the path I can either predefined all the inter mediate location from start to end. So user can select valid location for the particular path. Since it is predefined. But since this is hard coded it is bit overhead to maintain.
Use google place API. But there I can not restrict user to input specific locations between start and end. User can select invalid location which is not relevant.
What is the better approach I have to follow by overcoming the limitations?
I am developing an application based on location and map. I have a predefine route on map from location A to location B. Now i want to determine if any user navigates far from predefine route. How can we determine that the user is far away from predefine route. I tried a lot to find out any such API which is helpful but couldn't. Hope i will find some solution here.
You can use the PolyUtil.isLocationOnPath method from the Google Maps API Utility Library.
Ours is a financial app and to curb forgeries we wanted to access users location history from our android app.
The purpose behind this is if the user is requesting the service from a place where he hasn't been often or never been there, we would flag them or ignore them or implement another layer of security.
I have searched and found that google maps maintains location history and google plus may have an undocumented API also.
Please suggest how to get access to location history of device.
That's not possible unless you keep track of the location history yourself.
I am developing an app using App Inventor.
It includes the need for a user to press a button - to save a location when they are at the location.
But every time this is not practical. So I want to implement a method in my App Inventor app which will:
-Open Google Maps
-Let the user select any point on the map with no additional info.
-After choosing, return to the app and return latitude, longitude values for the location that is selected.
This is really important for me, help will be appreciated. Thanks!
You can find an example How to get coordinates for any Location on Google Maps back to App Inventor here: http://puravidaapps.com/coordinates.php