Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. private void GetCompaniesByLocation(double latitude,double longitude)
  2. {
  3. string url = "http://127.0.0.1/testapi/handler.php/latlong/" + latitude + "/" + longitude;
  4. BitmapDescriptor icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.here_icon);
  5.  
  6. Companies[] onlines = CallRestServiceCompanies(url);
  7. int i = 0;
  8. foreach (Companies online in onlines)
  9. {
  10. if (i == 0) {
  11. locationPoint = new LatLng(online.address_lat, online.address_long);
  12. CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(locationPoint, 16);
  13. mMap.AnimateCamera(camera);
  14. i++;
  15. }
  16. LatLng latlng = new LatLng(online.address_lat, online.address_long);
  17. MarkerOptions options = new MarkerOptions();
  18.  
  19. options.SetPosition(latlng);
  20. options.SetTitle(online.company_name);
  21. options.SetSnippet(online.company_website);
  22. options.SetIcon(icon);
  23.  
  24. mMap.AddMarker(options);
  25. }
  26. }
  27.  
  28. public void OnLocationChanged(Location location)
  29. {
  30. currentLocation = location;
  31. if(currentLocation != null)
  32. {
  33. GetCompaniesByLocation(currentLocation.Latitude, currentLocation.Longitude);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement