Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void GetCompaniesByLocation(double latitude,double longitude)
- {
- string url = "http://127.0.0.1/testapi/handler.php/latlong/" + latitude + "/" + longitude;
- BitmapDescriptor icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.here_icon);
- Companies[] onlines = CallRestServiceCompanies(url);
- int i = 0;
- foreach (Companies online in onlines)
- {
- if (i == 0) {
- locationPoint = new LatLng(online.address_lat, online.address_long);
- CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(locationPoint, 16);
- mMap.AnimateCamera(camera);
- i++;
- }
- LatLng latlng = new LatLng(online.address_lat, online.address_long);
- MarkerOptions options = new MarkerOptions();
- options.SetPosition(latlng);
- options.SetTitle(online.company_name);
- options.SetSnippet(online.company_website);
- options.SetIcon(icon);
- mMap.AddMarker(options);
- }
- }
- public void OnLocationChanged(Location location)
- {
- currentLocation = location;
- if(currentLocation != null)
- {
- GetCompaniesByLocation(currentLocation.Latitude, currentLocation.Longitude);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement