| Author |
Message |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2660 Location: College Park, MD
|
|
| Back to top |
|
 |
|
|
 |
to__liuyi Freshman

Joined: 04 Feb 2008 Posts: 4
|
Posted: Wed Feb 27, 2008 2:31 am Post subject: tried |
|
|
| I have tried to add the dot, it doesn't work. And I checked spelling of Weatherforecast.
|
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2660 Location: College Park, MD
|
|
| Back to top |
|
 |
to__liuyi Freshman

Joined: 04 Feb 2008 Posts: 4
|
Posted: Thu Feb 28, 2008 3:08 am Post subject: |
|
|
| well done! good job!
|
|
| Back to top |
|
 |
shriya Once Poster

Joined: 08 Aug 2008 Posts: 1
|
Posted: Fri Aug 08, 2008 10:12 am Post subject: weather Info |
|
|
If we use the Google RSS feed to take the weather data do we need to show the google trademark on our site?
It will be really helpful if I get reply immediately?
Thanks,
Shriya
|
|
| Back to top |
|
 |
jujudellago Freshman

Joined: 13 Sep 2008 Posts: 3
|
Posted: Sat Sep 13, 2008 12:00 pm Post subject: |
|
|
| plusminus wrote: | Hello icer,
the weather Data is openly provided by Google and therefore we can us it for free.
I don't know whether there is any document out there describing how to use the API, just use it
Regards,
plusminus |
Hi,
I found this very interresting topic while googling for a solution to have a dynamic weather forecast solution in a web app.
I have adapted the principle to a ruby system fetching and caching the results of the query, then parsing it with XMLSimple.
It worked really well, I just had time to run a few tests before everything got messed up... queries in my browser such as
http://www.google.com/ig/api?weather=geneva,switzerland give me no error, but fetching the datas from my program, with the same queries return something like this:
| XML: |
<?xml version=\"1.0\"?><xml_api_reply version=\"1\"><weather module_id=\"0\" tab_id=\"0\"><problem_cause data=\"\"/></weather></xml_api_reply> |
I did not find any information on the usage of the weather API, so my feeling is that google doesn't allow such queries ... does anyone use this service ? I would love to "just use it" but I'm sure the google people are just smarter than me....
regards
julien
|
|
| Back to top |
|
 |
|
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2660 Location: College Park, MD
|
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2660 Location: College Park, MD
|
|
| Back to top |
|
 |
jujudellago Freshman

Joined: 13 Sep 2008 Posts: 3
|
Posted: Sat Sep 13, 2008 4:07 pm Post subject: |
|
|
| plusminus wrote: |
Same with me here, two days ago it was still working
I'll see if I can find something...
Regards,
plusminus |
wow just 2 days ? I felt like these google weather tricks would just bring me troubles, and as I'm very bored today, I played around with the weather.com services...
http://www.weather.com/services/xmloap.html
not so easy to use as the google one, but it gives more complete results... well if the google weather gives you problems you can try...
regards
julien
|
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2660 Location: College Park, MD
|
Posted: Sun Sep 14, 2008 12:11 am Post subject: |
|
|
| jujudellago wrote: | | plusminus wrote: |
Same with me here, two days ago it was still working
I'll see if I can find something...
Regards,
plusminus |
wow just 2 days ? I felt like these google weather tricks would just bring me troubles, and as I'm very bored today, I played around with the weather.com services...
http://www.weather.com/services/xmloap.html
not so easy to use as the google one, but it gives more complete results... well if the google weather gives you problems you can try...
regards
julien |
Can it resolve weather for Latitude/Longitude pairs?
_________________
Download my apps  Please remember, that this board is give & take 
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
jujudellago Freshman

Joined: 13 Sep 2008 Posts: 3
|
Posted: Sun Sep 14, 2008 1:00 pm Post subject: |
|
|
| plusminus wrote: |
Can it resolve weather for Latitude/Longitude pairs? |
No, that's the "not so easy part", the queries must be made with a specific city ID, so you must fetch the city ID from a given city.
I did not find a city database for weather.com, so I populated the maxmind city database http://www.maxmind.com/app/city then I internally calculate the nearest city to query weather.com (it's all made very easy with some ruby on rails plugins...)
|
|
| Back to top |
|
 |
cmveas Freshman

Joined: 20 Oct 2008 Posts: 2
|
Posted: Wed Oct 22, 2008 12:21 am Post subject: Problem connecting to the weather |
|
|
Hello Plusminus I was trying to make the example work but I have a problem when I tried to connect to the "service"
http://www.google.com/ig/api?weather=
| Java: | String cityParamString = ((EditText) findViewById(R.id.edit_input))
.getText().toString();
String queryString = "http://www.google.com/ig/api?weather="
+ cityParamString;
/* Replace blanks with HTML-Equivalent. */
url = new URL(queryString.replace(" ", "%20"));
/* Get a SAXParser from the SAXPArserFactory. */
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
/* Get the XMLReader of the SAXParser we created. */
XMLReader xr = sp.getXMLReader();
/*
* Create a new ContentHandler and apply it to the
* XML-Reader
*/
GoogleWeatherHandler gwh = new GoogleWeatherHandler();
xr.setContentHandler(gwh);
InputStream input = url.openStream(); ---> EXCEPTION OCCURS HERE
/* Parse the xml-data our URL-call returned. */
xr.parse(new InputSource(input)); |
I debugged the code and when the line InputStream input = url.openStream(); executes in throws and exception. The monitor showed me this
| Java: | 10-21 23:00:19.182: ERROR/WeatherForcaster(169): java.net.SocketException: [b][u]unknown error[/u][/b]
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.platform.OSNetworkSystem.createSocketImpl(Native Method)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.platform.OSNetworkSystem.createSocket(OSNetworkSystem.java:79)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.net.PlainSocketImpl2.create(PlainSocketImpl2.java:59)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at java.net.Socket.checkClosedAndCreate(Socket.java:763)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at java.net.Socket.connect(Socket.java:910)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:61)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:800)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:786)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1030)
10-21 23:00:19.182: ERROR/WeatherForcaster(169): at java.net.URL.openStream(URL.java:664) |
I tested the connectivity with the emulator but I can perform any search with it so I think that the internet conection must be working well so that leaves me without a clue about what must be wrong. By the way Im running the example with SDK 1.0 I hope that helps.
Any suggestion will be welcome and thanks for making available all these examples.
|
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2660 Location: College Park, MD
|
Posted: Wed Oct 22, 2008 1:15 am Post subject: |
|
|
Hi cmveas,
did you add the ACCESS_INTERNET Permission to the AndroidManifest.xml
Regards,
plusminus
_________________
Download my apps  Please remember, that this board is give & take 
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
cmveas Freshman

Joined: 20 Oct 2008 Posts: 2
|
Posted: Wed Oct 22, 2008 3:41 am Post subject: Perfect!! |
|
|
Thanks plusminus I did not know that! and it worked perfectly. Thanks for the help!
Claudio Veas (cmveas)
|
|
| Back to top |
|
 |
jeffy2010 Freshman

Joined: 18 Nov 2008 Posts: 5
|
|
| Back to top |
|
 |
|