Getting google search result for android application - android

I googled this for quiet a bit tonight and haven't really came across a good solution.
I simply needed to run a query on google and retrieve the top, say 10 results. Right now the only information I need is the URL of the top 10 results. It seems like Google puts a lot of limitations if you want the results returned as in xml, unless you're a paid customer. So what's my best option here? Simply GET the html of the "http://google.com/search?q=" and try to parse it out manually? Is there a better method of doing so?

Related

Want my app to export data into html file

It's late and my brain can't even think of the proper things to search for to find the help I need.
Here's what I'm aiming for:
My app takes in a bunch of data from the user. Specifically sizes for windows and doors around a house. My app takes all that data and determines how much material is required, etc.
Here's where I'm stuck:
What I'd like to do is turn that all into a fancy looking report and offer the user the ability to print it. I figured the easiest way to do that would be to generate a report using HTML (or PDF) and have it open up in a web browser, which already has print capabilities.
Can anyone tell me if this seems like a good strategy for what I'm trying accomplish? And if so, point me in the right direction (or to the exact same questions that's already been answered somewhere on this forum).
Thanks.

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.

Android, preferred method for accessing 10,000+ record database on server

So I am in need of some assistance in trying to determine what I am going to need in order to accomplish a task.
Plain and simple...I am looking at accessing multiple databases some of which may contain over 10,000 records via Android. From what I have seen web services that return JSON is the way to go for something of this nature, but I don't think that fully answers my question or know if this is the preferred way to go about this.
Digging a bit deeper...I have a few apps on the market now, but this will be my first attempt at an enterprise style app, and I have accessed public web services with a lot smaller footprint than what this is going to be. I have little to no experience within the realm of server/network administration which is where I am getting tripped up. This is from the ground up and I have to ability to obtain almost any resources I need to complete this task.
It appears that there is a SQL Server 2008 on the back end if that helps. If I need to provide further details let me know. I am looking at a solution that will handle organizational growth, scalability, authentication and ease of user...so keep that in mind too.
So what is the best practice/preferred method for doing an enterprise application with a substantial data set? What are the big dogs doing, and how? Both on the client side and server side. I am trying not to "screw the pooch" out of the gates on this, and this is one of those measure twice and cut once situations which is why I am trying to garner plenty of input and assistance.
Thanks in advance!
If you don't have an API/service yet, you need to write one on top of your database.
I can think of two approaches, depending upon your use case.
Paging: Setup an API that supports paging, and show the results page by page. The user can't possibly view 10000 records in one go.
Search and suggest: Try creating a suggestion list, when the user starts typing out something. Fetch results that start with the initial characters entered. However, the API should limit the results to a comfortable number, so that you don't have to parse a lot.
Depending on your use case, you could try one of these.

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 implement a search like the google maps address search?

I would like to create a search in my app which acts like the map search in the Google Maps app.
I have creates an an auto complete text view which updates dynamically based on the results of the Geocoder.GetLocationByName() Method.
However the results retrieved from this function are really bad and not at all consistent with the text I pass to it.
Is there a better method of doing this to achieve accurate results?
So it's not the geosearch that's your problem, but the autocompletion, right? Well I assume you need the whole set of possible values in order to obtain a decent auto-completion. Another way would be to take apart the google javascript code that performs the auto-completion and talk to their servers, pretending you're typing into one of "their" fields. However, this isn't only probably against their terms of service but also a bit shaky because they might a) detect and prevent this or b) change their interface in the future.
Your best guess would be to get a list of all cities, streets, etc in question.
hopefully this should be able to do the trick :=)
https://developers.google.com/places/documentation/autocomplete
good luck (testing it myself right now)

Categories

Resources