Using Google Maps to display Search Results - android

I've been searching all up and down google trying to find this as well as SO. I just want a simple url that will display 1) The person's current location and 2) All search results in that area pertaining to the search string that I supply. So it would look something like this preferably.
http://maps.google.com/maps?location=currentlocation&radius=500&keyword=food
Where the keyword food is any search string that I would like placed in there. I need this to be a url that can be opened in both iPhone and Android (at the very least iPhone). I plan on opening it in a webview or the maps app.
Also yes I have tried plugging in long/lat in place of current location as well and still couldn't get it working. And I know that I will probably end up having to get their long/lat in code and using that, I just want the area search portion to work. If you have any ideas on how to get what I'm trying to accomplish I would appreciate it.

This is the link I get from Google Maps when I search food.
http://maps.google.com/maps?q=food&hl=en&sll=40.796934,-73.949232&sspn=0.018924,0.023174&hq=food&t=m&z=16
It seems to break down like this:
Base URL
http://maps.google.com/maps?
Search Term
q=food
Position
sll=40.796934,-73.949232
Span
sspn=0.018924,0.023174
Zoom Level
z=16

Related

How to create an nearby places android app using Google Place API?

I want to create an android app like nearby places (Shops,travelling places, Restaurants, etc). How to get the basics of Place API for android? Can someone give me any recommendations or ideas?
App Feathers -
When user opened my app, It's should be show to the user whats near to his place whatever he go.
Any Recommendations?
Google places Nearby Search lets you search for places within a specified area. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
More details : https://developers.google.com/places/web-service/intro
You can use below API:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=1500&type=restaurant&keyword=cruise&key=YOUR_API_KEY
First read and implement Maps SDK for Android
and then basically you need coordinates of the places that you want to show user and the location of user. Good luck!

Android - find image link API

Hey !
I have an Android app where the user can search on a specific subject, let's take the word "Cats" for example. When the user submits the search I want to find an image similar or on the subjects the searched for. A search engine for images more or less. I want something "easy" to deal with, so I thought about integrating the Google Search API into my app. Let the user search Google, and take the first image that comes up.
However, I haven't found any example and I just need a push in the right direction. If you could give me an example API for my needs, that'd be great.
Apparently the Google Search API never was fully deprecated it's still up and running. It provides JSON data and is easily parsed with Android.
If anyone else needs an image API here's a test search: https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=searchquery&rsz=8&start=1&imgsz=small|medium
And the JSON reference: https://developers.google.com/image-search/v1/jsondevguide

Getting the nearest results in Geocoder and show them and some other questions about Geocoder

I am working on an application which will have a textview/searchview or a more preferrable way to take a String, make a search of that string and show some results. And whenever the user clicks one of the result it will take user to the another Intent which have a map that points to the clicked results.
I am searching this for days, I read many articles in here, or in Google Developer pages, I know that I need to use Geocoder, and for this I think the best one for my app is this Google API
http://maps.googleapis.com/maps/api/geocode/json?address="+geocodingSearch+"&components=country:TR&sensor=false";
geocodingSearch will be the String that written by user.
*My first question is does sensor=true makes a big difference? Do you prefer to use it? Or do you prefer something else?
*In Google's example it uses region=es in one of them and components=country:ES in another of them. What are the differences between them? Also does it works perfectly, or using borders is better?
*I don't have any problem of parsing JSON answer, but I am not sure about how to show the results. I want it to be seen as the way that search results as in the bottom. It doesn't need to make a search as the user types, but the result part will be better like this. Do I need to use a SearchView or something else?
*And the final question is written in the title. Is it possible to get the nearest results at top in Google API part (I am able to get the Location), I don't want to limit by borders, but getting the nearest results will be better. If this is not possible I will try to sort them by making calculations with LatLong values.
Thanks in advance, and I will be greatful by your helps.

Querying the time using Google Search Results

This one is puzzling me...
For my Android application I want to be able to return the current time in any location the user requests (right down to city level). The request itself comes from a voice command, so I cannot use alternative methods.
The most obvious way (so I thought) was to query Google, but I need your brains to help me solve how to extract the data I want please!
In Google, query:
"What's the time in China"
You should see a 'widget' at the top displaying the answer nicely. View the page source and search on 'China' and it's there - I thought great, this is going to be easy!
But...
"What's the time in London"
Although the display in Google appears the same, there is no result for 'London' when searching the source HTML...?
Using Google Chrome, I inspect the element of the 'widget' and can then view the contents I wish to extract in all cases.
So, my questions is firstly, am I missing something obvious (Google don't want us to be able to do this for example)? Or is there a way to 'force' the result to be in the HTML by structuring the query perhaps?
Secondly, is there a way to access the specific 'element container' and return the results to my Android Application?
I thank you in advance...
You should really use an API instead of parsing html.
I guess there are many many API which will give you the time in a given city.
http://www.worldweatheronline.com/time-zone-api.aspx for example (havnt tried it myself)
If you still want to extract data from the google result (which is html), check for html parsers like in this post : Parse HTML in Android

How to let Android users search for closest points of interest created by me on Google Maps?

I want to mark historical 'points of interest' across the globe on a mapping solution such as Google Maps (or something else).
I'll be getting an Android app created in which I want to be able to provide the users the ability to search for and locate the nearest such 'point of interests' around their current location.
Should I be using Google Maps or something else like OSM?
How should I be marking them on Google or elsewhere?
(a) I want to be able to mark these places with pictures as well and
(b) I want to store them at my end in a generic format as well, just in case!
How should the Android app search for the closest such points?
As I understand, Google Maps can show its own map overlaid with my data when I provide a KML file (http://code.google.com/apis/kml/documentation/kmlSearch.html). Can that be shown "within an Android app"? (ie, I know it can be shown on a webpage, but can it be shown in a native app?)
I will suggest google maps. Reason is google maps is updated often and part
of the maps from osm is not as latest.
Probably store this marking in your own datastore called point_of_interest.
The info window is also a special kind of overlay for displaying content
(usually text or images) within a popup balloon on top of a map at a given
location. read here for more information.
your android app should detect current user location and send the information
such as latitude and longitude to your server. Hence the query to search
for point of interest is done by the server and process the data and send
back to user android app. For example, the query would be something like
select * from point_of_interest where distance < 10km limit 5;
yes, read this link
Ok, for an app I built for a customer, we had a similar requirement. Basically, I needed to display the locations of interest withing 200miles of my current location. The way this worked for me was that I took my current location and made a Web Services call to their servers where they did the Geographic calculation and returned a list of results to me.
I would have the Android app just use the MapView and then user Overlays to display icons on the map. The problem with displaying the items using kml is that they will not be clickable by the user so their will be no interactivity. If you do choose to do it with kml, there is some example code located in this project: https://github.com/sunlightlabs/congress
I prefer google maps. Google maps SDK looks good and the sdk performs well. I don't know a SDK that has something like a OSMMapView that offers the same performance and features like google maps does (please correct me). But OSM can be as visual appealing as google maps. Cloudmade has tons of different styles for OSM data.
If you want to display maps by google, you have to use the Maps Library that ships with the Android SDK.
You can display any Views on top of the google maps. I.e. use mapviewballoons on github.
If you have lots of POIs that you want to display you should definitely persist you data with a spatial index. So that nearest neighbour searches are fast. One solution would be to use sqlite R*Trees. I did not use them on android and they work not out of the box you have to build sqlite-android yourself (see this question). Or use Perst, or ...
If you have few data, that fits into the phone memory you can use a Quadtree. This would be even faster than the db when searching it. You will find lots of examples when you google it. You could store the data as xml, json or even serialize the whole quadtree with the java Serializable interface.
There are tons of possibillities this question is way too broad. Some random ideas:
Create a server that responds to bounding box searches over HTTP and store the POIs in a Quadtree.
Deliver all your POIs with the app. As database, xml, json or a serialized Quadtree.
I don't have experience with kml on Android.

Categories

Resources