public void OnMapReady(GoogleMap googleMap) { map = googleMap; map.MyLocationEnabled = true; map.MapType = GoogleMap.MapTypeNormal; map.UiSettings.ZoomControlsEnabled = true; //map.UiSettings.CompassEnabled = true; map.UiSettings.SetAllGesturesEnabled(true); //map.UiSettings.RotateGesturesEnabled = true; map.AddMarker(new MarkerOptions().SetPosition(Location_NewYork)); map.SetOnMarkerClickListener (this); /*LocationManager locManager = GetSystemService (Context.LocationService) as LocationManager; if (locManager.IsProviderEnabled (LocationManager.GpsProvider)) { locManager.RequestLocationUpdates (1000, 10, criteria, this, null); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("GPS Disabled"); builder.SetMessage("Enable GPS to use the app"); builder.SetCancelable(false); builder.SetPositiveButton("OK", delegate { StartActivityForResult (new Intent(Android.Provider.Settings.ActionLocationSourceSettings), 0); }); builder.Show(); }*/ FindViewById<Button> (Resource.Id.sharebutton).Click += delegate { { var geoUri = Android.Net.Uri.Parse ("geo:"+ _currentLocation.Latitude+","+_currentLocation.Longitude); var mapIntent = new Intent (Intent.ActionView, geoUri); //mapIntent.SetType( //StartActivity (mapIntent); var smsUri = Android.Net.Uri.Parse("smsto:1234567890"); var smsIntent = new Intent (Intent.ActionSendto, smsUri); StringBuilder smsstring = new StringBuilder(); smsstring.Append("Click the link to track "); smsstring.Append("http://maps.google.com?q="); smsstring.Append(_currentLocation.Latitude); smsstring.Append(","); smsstring.Append(_currentLocation.Longitude); smsIntent.PutExtra ("sms_body",smsstring.ToString() ); StartActivity (smsIntent); } }; }
public void OnMapReady( GoogleMap map ) { // sanity checks in case loading the map fails (Google Play can error) if ( map != null ) { Map = map; // because google can actually give me a valid map that isn't actually ready. try { // For privacy, turn off the map toolbar, which prevents people from getting specific driving directions // to neighborhood group houses. Map.UiSettings.MapToolbarEnabled = false; Map.SetOnMarkerClickListener( this ); // set the map to a default position // additionally, set the default position for the map to whatever specified area. Android.Gms.Maps.Model.LatLng defaultPos = new Android.Gms.Maps.Model.LatLng( ConnectConfig.GroupFinder_DefaultLatitude, ConnectConfig.GroupFinder_DefaultLongitude ); CameraUpdate camPos = CameraUpdateFactory.NewLatLngZoom( defaultPos, ConnectConfig.GroupFinder_DefaultScale_Android ); map.MoveCamera( camPos ); // see if there's an address for this person that we can automatically use. if ( RockMobileUser.Instance.HasFullAddress( ) == true ) { // if they don't already have any value, use their address if ( string.IsNullOrEmpty( StreetValue ) == true && string.IsNullOrEmpty( CityValue ) == true && string.IsNullOrEmpty( StateValue ) == true && string.IsNullOrEmpty( ZipValue ) == true ) { SearchPage.SetAddress( RockMobileUser.Instance.Street1( ), RockMobileUser.Instance.City( ), RockMobileUser.Instance.State( ), RockMobileUser.Instance.Zip( ) ); } else { // otherwise use what they last had. SearchPage.SetAddress( StreetValue, CityValue, StateValue, ZipValue ); } } else { // otherwise, if there are values from a previous session, use those. SearchPage.SetAddress( StreetValue, CityValue, string.IsNullOrEmpty( StateValue ) ? ConnectStrings.GroupFinder_DefaultState : StateValue, ZipValue ); } } catch { } } }
private void SetupMapIfNeeded() { if (_map == null) { _map = _mapFragment.Map; if (_map != null) { SetViewPoint (new LatLng(63.430515, 10.395053), false); _clusterManager = new ClusterManager (this, _map); _clusterManager.SetOnClusterClickListener (this); _clusterManager.SetOnClusterItemClickListener (this); _map.SetOnCameraChangeListener (_clusterManager); _map.SetOnMarkerClickListener (_clusterManager); AddClusterItems (); } } }