so after a ton on investigation I am pretty sure that it was a
business decision to restrict this. There are non google alternatives
though.

Clay


On Nov 15, 12:52 pm, Clay <claytan...@gmail.com> wrote:
> So I have been looking into this for a couple of days, and I am pretty
> sure the intent of the android API team is to make SearchManager a
> platform level tool for searching application level content, like a
> application database, which is very cool, and I will probably use, but
> not what I want at this moment.
>
> I want to be able search a map just like the Google search apis for
> javascript:
>
> // We'll wait to the end to actually initialize the map
>       // So let's build the search control
>       searchControl = new google.search.SearchControl();
>
>       // Initialize a LocalSearch instance
>       searcher = new google.search.LocalSearch(); // create the object
>       //google.search.LocalSearch.ADDRESS_LOOKUP_ENABLED
>
>       searcher.setCenterPoint(map); // bind the searcher to the map
>
>       // Create a SearcherOptions object to ensure we can see all
> results
>       var options = new google.search.SearcherOptions(); // create the
> object
>       options.setExpandMode
> (google.search.SearchControl.EXPAND_MODE_OPEN);
>
>       // Add the searcher to the SearchControl
>       searchControl.addSearcher(searcher , options);
>
>      // And second, we need is a search complete callback!
>       searchControl.setSearchCompleteCallback(searcher , function() {
>         map.clearOverlays();
>         var results = searcher.results; // Grab the results array
>         // We loop through to get the points
>         for (var i = 0; i < results.length; i++) {
>           var result = results[i]; // Get the specific result
>           var markerLatLng = new google.maps.LatLng(parseFloat
> (result.lat),
>                                                     parseFloat
> (result.lng));
>           var marker = new google.maps.Marker(markerLatLng); // Create
> the marker
>
>           // Bind information for the infoWindow aka the map marker
> popup
>           marker.bindInfoWindow(result.html.cloneNode(true));
>           result.marker = marker; // bind the marker to the result
>           map.addOverlay(marker); // add the marker to the map
>         }
>
> This *was* in previous versions of the API (1.0?) I have seen very old
> code like:
>
> // W00t! Search for Pizza.
>             // Create a MapPoint from the map's coordinates
>             MapPoint mapPoint = new MapPoint(mMapView.getMapCenter
> ().getLatitudeE6(),
>                     mMapView.getMapCenter().getLongitudeE6());
>             // Create a dummy Map for use in Search
>             Map map = new Map(getDispatcher(), null, 0, 0, 0,
> mapPoint,
>                     Zoom.getZoom(mMapView.getZoomLevel()), 0);
>             // Search for Pizza near the specified coordinates
>             Search search = new Search("Pizza", map, 0);
>             // add the request the dispatcher
>             getDispatcher().addDataRequest(search);
>             // Wait for the search to complete, Should do this
>             // in another thread ideally, this is just for
> illustration here.
>             while (!search.isComplete()) {
>                 Log.i(LOG_TAG, ".");
>             }
>
>             // Print the details.
>             Log.i(LOG_TAG, "Done - " + search.numPlacemarks());
>             MapPoint point = null;
>             for (int i = 0; i < search.numPlacemarks(); i++) {
>                 Placemark placemark = search.getPlacemark(i);
>                 point = placemark.getLocation();
>                 Log.i(LOG_TAG, " - i : " + Integer.toString(i));
>                 Log.i(LOG_TAG, "- Bubble : " +
> placemark.getBubbleDescriptor());
>                 Log.i(LOG_TAG, "- Detail : " +
> placemark.getDetailsDescriptor());
>                 Log.i(LOG_TAG, "- Title : " + placemark.getTitle());
>                 Log.i(LOG_TAG, "- Location : " + placemark.getLocation
> ().toString());
>                 Log.i(LOG_TAG, "- routable : " +
> placemark.routableString());
>             }
>
>             // Animate to the last location.
>             if (point != null) {
>                 MapController mc = mMapView.getController();
>                 Point point1 = new Point(point.getLatitude(),
> point.getLongitude());
>                 mc.animateTo(point1);
>                 mc.zoomTo(12);
>                 Log.i("animateTo", point1.toString());
>             }
>
> I have been thinking it could be possible by geocoding an address
> using the location manager:
>
> //first find the location using geocoding
>                 Geocoder geocoder =
>                         new Geocoder(getApplicationContext(), 
> Locale.getDefault());
>                 try {
>                                 List<Address> addrs =
>                                         
> geocoder.getFromLocation(mMyLocationLat, mMyLocationLon, 1);
>
>                         } catch (IOException e) {
>                                 Log.e(TAG, "geocoding failed");
>                         }
>
> and then pre populating the search with something like "pizza @94611",
> but right now when I do search the results go to a browser, I really
> want to be able to parse the results myself using an api.
>
> Does anyone know of an example like this or can give me some advice,
> the API docs on SearchManager are a little difficult because I think
> the intentions are mixed. Is this the right approach? Is it even
> possible?
>
> Clay

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to