Ok,
here is my solution:
private void searchOnMap(String search) {
// ** brings up Google Maps with results, but unable to pass data back
to my app - no go
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:
0,0?q=" + search.replace(" ", "+")));
// this.startActivityForResult(intent, MAP_ACTIVITY);
// ** works with address only; NO BUSINESS search - no go
// Geocoder geoCoder = new Geocoder(this);
// try {
// List<Address> results =
geoCoder.getFromLocationName(search,
MAX_SEARCH_RESULTS);
// int a=results.size();
// } catch (IOException e) {
// e.printStackTrace();
// }
// ** works like a charm! The only unsure is the map key. I generated
for http://localhost; see how far we get
StringBuilder responseBuilder = new StringBuilder();
try {
URL url = new
URL("http://ajax.googleapis.com/ajax/services/search/
local?v=1.0&q="
+ URLEncoder.encode(search, "UTF-8")
+
"&key=ABQIAAAArsnSCSicZxq21ogV4Uu_JxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ3l8j5e79VEU4_ht1ROH0YrZtWuw");
BufferedReader in = new BufferedReader(new InputStreamReader
(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
responseBuilder.append(inputLine);
}
in.close();
} catch (MalformedURLException me) {
me.printStackTrace();
} catch (UnsupportedEncodingException ue) {
ue.printStackTrace();
} catch (IOException ie) {
ie.printStackTrace();
}
try {
JSONObject json = new
JSONObject(responseBuilder.toString());
int a = json.length();
} catch (JSONException e) {
e.printStackTrace();
}
}
On Feb 3, 1:25 pm, gnugu <[email protected]> wrote:
> John,
> regarding your
> suggestionhttp://code.google.com/apis/ajaxsearch/documentation/#fonje.
>
> What map key would I use? As far as I know it tied to a domain name.
> Any suggestions?
>
> On Feb 3, 1:12 pm, gnugu <[email protected]> wrote:
>
> > I too have the same experience. Can someone from Google confirm this
> > being a bug???
>
> > On Jan 27, 9:08 am, Sunny <[email protected]> wrote:
>
> > > Adding to my email below, let me share with you what I am trying to do
> > > and the results I get:-
>
> > > List<Address> wfList = gc.getFromLocationName(sb.toString(),5 )
> > > where sb contains the address " Whole Foods, Los Gatos, CA". what I
> > > was expecting from above was a list of address of whole food locations
> > > in this area.
>
> > > However the wfList returns a size 0. This is a well formed address and
> > > I was expecting it to work. Examples given for this method
> > > (getFromLocationName) gives the impression that partial address like
> > > the above should work -like "Dalvik, Iceland", an address such as
> > > "1600 Amphitheatre Parkway, Mountain View, CA", an airport code such
> > > as "SFO", etc.. but it is not the case :-(.
>
> > > Maybe I am doing something wrong and I need to get out of the
> > > woods !. Any clues !!
>
> > > On Jan 21, 5:00 pm, Sunny <[email protected]> wrote:
>
> > > > Thanks Jeff, john.
>
> > > > I tried with GeocodergetFromLocationName- it does not return
> > > >businessbased results unless you have the complete address. I would
> > > > greatly appreciate if you have a code piece written that works. I am
> > > > using android 2.1.
>
> > > > thanks
> > > > Sunil.
>
> > > > On Jan 20, 11:15 am, jeffro <[email protected]> wrote:
>
> > > > > Check out the GeoCoder class and thegetFromLocationNamemethods. You
> > > > > can input a search string like "whole foods,
> > > > > los gatos, CA" and it will return a list of Address results. You can
> > > > > also specify a bounding box if you want to limit your results to your
> > > > > current map.
>
> > > > >http://developer.android.com/reference/android/location/Geocoder.html
>
> > > > > Jeff
> > > > > --------------------------------------------------------------------------------------------------------
> > > > > Trackaroo
> > > > > Trackmaster - Motorsports Lap Timer (http://trackmaster.trackaroo.com)
> > > > > Dynomaster - Performance Dyno (http://dynomaster.trackaroo.com)
>
> > > > > On Jan 19, 10:41 am, John <[email protected]> wrote:
>
> > > > > > Google provides a fairly simple interface for local searches.
>
> > > > > >http://code.google.com/apis/ajaxsearch/documentation/#fonje
>
> > > > > > In the search request you can specify a latitude and longitude with
> > > > > > the text to get a reference to those nearby businesses. Here is the
> > > > > > reference to the parameters for the search.
>
> > > > > >http://code.google.com/apis/ajaxsearch/documentation/reference.html#_...
>
> > > > > > You can simply make a http call and parse the json response when it
> > > > > > comes back. It should be straight forward from there.
>
> > > > > > Thanks,
> > > > > > John
>
> > > > > > On Jan 17, 8:00 pm, sunny <[email protected]> wrote:
>
> > > > > > > Hi Folks,
> > > > > > > wondering if any of you can help.
> > > > > > > This is what I am trying to do:
> > > > > > > simple app to get list of addresses I am interested in based on
> > > > > > > my current
> > > > > > > location.
>
> > > > > > > I get the current location using location services. Now, based on
> > > > > > > this
> > > > > > > current location I want to do a search onbusinessplaces without
> > > > > > > really
> > > > > > > using the SearchManager's triggerSearch. The problem with the
> > > > > > > triggerSearch
> > > > > > > is that it launches the googlemap and show thebusinessaddress I am
> > > > > > > looking for and it is blocked. I want to get the control back.
> > > > > > > I do not
> > > > > > > want to launch the map with the listing. all I want to do is the
> > > > > > > get the
> > > > > > > Geopoint of thebusinessaddress I am interested in using a simple
> > > > > > > web
> > > > > > > search. I tried reverseGeocoding , but it is does not work
> > > > > > > withbusiness
> > > > > > > address. It needs full address. any suggestion?.
>
> > > > > > > Simply put, all I want to do is a simple websearch , say
> > > > > > > query="whole foods,
> > > > > > > los gatos, CA" to get its full address. and then use it to get
> > > > > > > the GeoPoint.
>
> > > > > > > I am stuck and wondering if anyone can give me some pointers.
>
> > > > > > > thanks a ton in advance.
> > > > > > > Sunny.- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en