From 0f8f6fbcd85e2f3ddeef090e8a23d3bb2ee45540 Mon Sep 17 00:00:00 2001 From: Danesh Mondegarian Date: Wed, 3 Apr 2013 10:52:00 -0400 Subject: LockClock : Switch to new yahoo api Use YQL since where.yahooapis.com seems to have been shutdown Patchset 2 : add missing and gflags="R" Patchset 3 : Merge both urls into one Patchset 4,5 : Formatting improvements Change-Id: I7ce4e20679030fb5c71c3995a4fee7526d251310 --- src/com/cyanogenmod/lockclock/weather/YahooPlaceFinder.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/com/cyanogenmod/lockclock/weather/YahooPlaceFinder.java b/src/com/cyanogenmod/lockclock/weather/YahooPlaceFinder.java index 43d55a9..b08fc13 100755 --- a/src/com/cyanogenmod/lockclock/weather/YahooPlaceFinder.java +++ b/src/com/cyanogenmod/lockclock/weather/YahooPlaceFinder.java @@ -18,16 +18,19 @@ package com.cyanogenmod.lockclock.weather; import android.content.Context; +import android.net.Uri; + import com.cyanogenmod.lockclock.misc.Preferences; public class YahooPlaceFinder { - private static final String YAHOO_API_BASE_REV_URL = "http://where.yahooapis.com/geocode?appid=EKvCnl4k&q=%1$s,+%2$s&gflags=R"; - private static final String YAHOO_API_BASE_URL = "http://where.yahooapis.com/geocode?appid=EKvCnl4k&q=%1$s"; + private static final String YAHOO_API_BASE_URL = "http://query.yahooapis.com/v1/public/yql?q=" + + Uri.encode("select woeid from geo.placefinder where text ="); public static String reverseGeoCode(Context c, double latitude, double longitude) { - String url = String.format(YAHOO_API_BASE_REV_URL, String.valueOf(latitude), - String.valueOf(longitude)); + String formattedCoordinates = String.format("\"%s %s\" and gflags=\"R\"", + String.valueOf(latitude), String.valueOf(longitude)); + String url = YAHOO_API_BASE_URL + Uri.encode(formattedCoordinates); String response = new HttpRetriever().retrieve(url); if (response == null) { return null; @@ -42,7 +45,7 @@ public class YahooPlaceFinder { } public static String geoCode(Context c, String location) { - String url = String.format(YAHOO_API_BASE_URL, location).replace(' ', '+'); + String url = YAHOO_API_BASE_URL + Uri.encode(String.format("\"%s\"",location)); String response = new HttpRetriever().retrieve(url); if (response == null) { return null; -- cgit v1.2.3