public async Task SyncRegions() { var regionsDb = (await LocationClient.RegionsAsync()).SelectToList(r => new Region { JustinId = r.RegionId, Name = r.RegionName, CreatedById = User.SystemUser }); await Db.Region.UpsertRange(regionsDb) .On(v => v.JustinId) .WhenMatched((r, rnew) => new Region { Name = rnew.Name, JustinId = rnew.JustinId, UpdatedOn = DateTime.UtcNow }) .RunAsync(); //Any regions that aren't on this list expire/disable for now. This is for regions that may have been deleted. if (Expire) { var disableRegions = Db.Region.WhereToList(r => r.ExpiryDate == null && regionsDb.All(rdb => rdb.JustinId != r.JustinId)); foreach (var disableRegion in disableRegions) { Logger.LogDebug($"Expiring Region {disableRegion.Id}: {disableRegion.Name}"); disableRegion.ExpiryDate = DateTime.UtcNow; disableRegion.UpdatedOn = DateTime.UtcNow; disableRegion.UpdatedById = User.SystemUser; } await Db.SaveChangesAsync(); } }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); LocationClient.DetachIgnoreListener(); LocationManager.Stop(); LocationManager.LocationUpdated -= OnLocationUpdate; PointClient.QueryFailed -= OnQueryFailed; PointClient.PointsAdded -= OnPointsAdded; ContentView.AddLocation.Click -= OnAddLocationClick; ContentView.Done.Click -= OnLocationChosen; ContentView.Cancel.Click -= OnLocationChoiceCancelled; PointClient.PointListener.Click -= OnPointClicked; ContentView.MapView.MapEventListener = null; MapListener.MapClicked -= OnMapClicked; ContentView.Popup.Closed -= OnPopupClosed; ContentView.Content.CameraField.Click -= OnCameraButtonClick; Camera.Instance.Delegate.Complete -= OnCameraActionComplete; ContentView.Content.Done.Click -= OnDoneClick; }
public void AddGeofences() { // Start a request to add geofences mRequestType = RequestType.Add; // Test for Google Play services after setting the request type if (!IsGooglePlayServicesAvailable) { Log.Error(Constants.TAG, "Unable to add geofences - Google Play services unavailable."); return; } // Create a new location client object. Since this activity implements ConnectionCallbacks and OnConnectionFailedListener, // it can be used as the listener for both parameters mLoactionClient = new LocationClient(this, this, this); // If a request is not already underway if (!mInProgress) { // Indicate that a request is underway mInProgress = true; // Request a connection from the client to Location Services mLoactionClient.Connect(); } else { // A request is already underway, so disconnect the client and retry the request mLoactionClient.Disconnect(); mLoactionClient.Connect(); } }
////Lifecycle methods protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); Log.Debug ("OnCreate", "OnCreate called, initializing views..."); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // UI to print last location button = FindViewById<Button> (Resource.Id.myButton); latitude = FindViewById<TextView> (Resource.Id.latitude); longitude = FindViewById<TextView> (Resource.Id.longitude); provider = FindViewById<TextView> (Resource.Id.provider); // UI to print location updates button2 = FindViewById<Button> (Resource.Id.myButton2); latitude2 = FindViewById<TextView> (Resource.Id.latitude2); longitude2 = FindViewById<TextView> (Resource.Id.longitude2); provider2 = FindViewById<TextView> (Resource.Id.provider2); _isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled (); if (_isGooglePlayServicesInstalled) { // pass in the Context, ConnectionListener and ConnectionFailedListener locClient = new LocationClient (this, this, this); // generate a location request that we will pass into a call for location updates locRequest = new LocationRequest (); } else { Log.Error ("OnCreate", "Google Play Services is not installed"); } }
protected override void OnHandleIntent(Intent intent) { if (LocationClient.HasError(intent)) { Log.Debug(TAG, "Location Services error"); StartActivity(new Intent(this, typeof(AlarmErrorScreen)).AddFlags(ActivityFlags.NewTask)); } else { Log.Debug(TAG, "Location Services success"); var geofences = LocationClient.GetTriggeringGeofences(intent); if (geofences == null || geofences.Count <= 0) { return; } var requestId = geofences[0].RequestId; var dbManager = new DBManager(); var alarm = dbManager.GetAlarmByGeofenceRequestId(requestId); if (alarm == null) { return; } StartActivity(intent.SetClass(this, typeof(AlarmScreen)) .AddFlags(ActivityFlags.NewTask) .PutExtra(Constants.AlarmsData_Extra, JsonConvert.SerializeObject(alarm))); StartService(new Intent(this, typeof(UIWhileRingingIntentService)) .SetAction(UIWhileRingingIntentService.StartAlarmAction) .PutExtra(Constants.AlarmsData_Extra, JsonConvert.SerializeObject(alarm))); } }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); LocationClient.AttachIgnoreListener(); LocationManager.Start(); LocationManager.LocationUpdated += OnLocationUpdate; PointClient.QueryFailed += OnQueryFailed; PointClient.PointsAdded += OnPointsAdded; ContentView.AddLocation.Click += OnAddLocationClick; ContentView.Done.Click += OnLocationChosen; ContentView.Cancel.Click += OnLocationChoiceCancelled; PointClient.PointListener.Click += OnPointClicked; ContentView.MapView.MapEventListener = MapListener; MapListener.MapClicked += OnMapClicked; ContentView.Popup.Closed += OnPopupClosed; ContentView.Content.CameraField.Click += OnCameraButtonClick; Camera.Instance.Delegate.Complete += OnCameraActionComplete; ContentView.Content.Done.Click += OnDoneClick; UIKeyboard.Notifications.ObserveWillShow(OnKeyboardWillShow); UIKeyboard.Notifications.ObserveWillHide(OnKeyboardWillHide); }
public void OnDisconnected() { // Turn off the request flag mInProgress = false; // Destroy the current location client mLoactionClient = null; }
////Lifecycle methods protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Log.Debug("OnCreate", "OnCreate called, initializing views..."); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // UI to print last location button = FindViewById <Button> (Resource.Id.myButton); latitude = FindViewById <TextView> (Resource.Id.latitude); longitude = FindViewById <TextView> (Resource.Id.longitude); provider = FindViewById <TextView> (Resource.Id.provider); // UI to print location updates button2 = FindViewById <Button> (Resource.Id.myButton2); latitude2 = FindViewById <TextView> (Resource.Id.latitude2); longitude2 = FindViewById <TextView> (Resource.Id.longitude2); provider2 = FindViewById <TextView> (Resource.Id.provider2); _isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled(); if (_isGooglePlayServicesInstalled) { // pass in the Context, ConnectionListener and ConnectionFailedListener locClient = new LocationClient(this, this, this); // generate a location request that we will pass into a call for location updates locRequest = new LocationRequest(); } else { Log.Error("OnCreate", "Google Play Services is not installed"); } }
void LocationFound(Location location) { LocationClient.Latitude = location.Latitude; LocationClient.Longitude = location.Longitude; LocationClient.Accuracy = location.Accuracy; LocationClient.Update(); }
public FlightsController(DroneClient drones, LocationClient locations, OperatorClient operators, FlightClient flights, IMapper mapper) { _drones = drones; _locations = locations; _operators = operators; _flights = flights; _mapper = mapper; }
void OnLocationUpdate(object sender, LocationUpdatedEventArgs e) { LocationClient.Latitude = e.Location.Coordinate.Latitude; LocationClient.Longitude = e.Location.Coordinate.Longitude; LocationClient.Accuracy = e.Location.HorizontalAccuracy; LocationClient.Update(); }
public LocationPresenter(Activity activity) { mLocationClient = new LocationClient(activity, this, this); mLocationRequest = LocationRequest.Create(); mLocationRequest.SetPriority(LocationRequest.PriorityHighAccuracy); mLocationRequest.SetInterval(10 * 1000); mLocationRequest.SetFastestInterval(1000); }
public BaiduLocationServiceImpl() { myLocationListener = new MyLocationListener(); client = new LocationClient(MainActivity.Instance) { // 设置定位参数 LocOption = GetDefaultLocationClientOption() }; }
public void OnDisconnected() { Log.Debug("LocClient", "Disconnected"); client = null; // If the client was disconnected too early if (currentRequest != ConnectionUpdateRequest.None) { client = new LocationClient(this, this, this); client.Connect(); } }
public GPSform() { InitializeComponent(); SerialComLB.Items.Add("Not connected"); Cars = new List <Car>(); locClient = new LocationClient(); CarsBrake = new List <Car>(); CarsEmergencyBrake = new List <Car>(); groupBox_server.Enabled = false; comPortCBB.DataSource = SerialPort.GetPortNames(); SerialTimer.Start(); }
public LocationReporter(Context context, int userId) { mLocationClient = new LocationClient(context, this, this); mLocationRequest = LocationRequest.Create(); mLocationRequest.SetPriority(LocationRequest.PriorityHighAccuracy); mLocationRequest.SetInterval(10 * 1000); mLocationRequest.SetFastestInterval(1000); this.travelerLocation = new TravelerLocation(); this.travelerLocation.UserId = userId.ToString(); this.context = context; }
public async Task SyncCourtRooms() { var courtRoomsLookups = await LocationClient.LocationsRoomsAsync(); //To list so we don't need to re-query on each select. var locations = Db.Location.ToList(); var courtRooms = courtRoomsLookups.SelectToList(cr => new ss.db.models.LookupCode { Type = LookupTypes.CourtRoom, Code = cr.Code, LocationId = locations.FirstOrDefault(l => l.JustinCode == cr.Flex) ?.Id, CreatedById = User.SystemUser }).WhereToList(cr => cr.LocationId != null); //Some court rooms, don't have a location. This should probably be fixed in the JC-Interface var courtRoomNoLocation = courtRoomsLookups.WhereToList(crl => locations.All(l => l.JustinCode != crl.Flex)); Logger.LogDebug("Court rooms without a location: "); Logger.LogDebug(JsonConvert.SerializeObject(courtRoomNoLocation)); await Db.LookupCode.UpsertRange(courtRooms) .On(v => new { v.Type, v.Code, v.LocationId }) .WhenMatched((cr, crNew) => new ss.db.models.LookupCode { Code = crNew.Code, LocationId = crNew.LocationId, UpdatedOn = DateTime.UtcNow }) .RunAsync(); //Any court rooms that aren't from this list, expire/disable for now. This is for CourtRooms that may have been deleted. if (Expire) { var disableCourtRooms = Db.LookupCode.WhereToList(lc => lc.ExpiryDate == null && lc.Type == LookupTypes.CourtRoom && !courtRooms.Any(cr => cr.Type == lc.Type && cr.Code == lc.Code && cr.LocationId == lc.LocationId)); foreach (var disableCourtRoom in disableCourtRooms) { Logger.LogDebug($"Expiring CourtRoom {disableCourtRoom.Id}: {disableCourtRoom.Code}"); disableCourtRoom.ExpiryDate = DateTime.UtcNow; disableCourtRoom.UpdatedOn = DateTime.UtcNow; disableCourtRoom.UpdatedById = User.SystemUser; } await Db.SaveChangesAsync(); } }
//public static event EventHandler<LocationFailedEventArgs> Failed; //public static event EventHandler<LocationUpdatedEventArgs> LocationUpdated; public BaiduLocationServiceImpl() { try { mLocationClient = new LocationClient(MainApplication.Context) { LocOption = SetLocationClientOption() }; mLocationClient.RegisterLocationListener(myLocationListener); } catch (Java.Lang.Exception ex) { Android.Util.Log.Error("上报", ex.Message); } }
/// <summary> /// Handles incoming intents /// </summary> /// <param name="intent">The intent sent by Location Services. This Intent is provided to Location Services (inside a PendingIntent) /// when AddGeofences() is called</param> protected override void OnHandleIntent(Android.Content.Intent intent) { // First check for errors if (LocationClient.HasError(intent)) { int errorCode = LocationClient.GetErrorCode(intent); Log.Error(Constants.TAG, "Location Services error: " + errorCode); } else { // Get the type of Geofence transition (i.e. enter or exit in this sample). int transitionType = LocationClient.GetGeofenceTransition(intent); // Create a DataItem when a user enters one of the geofences. The wearable app will receie this and create a // notification to prompt him/her to check in if (transitionType == Geofence.GeofenceTransitionEnter) { // Connect to the Google Api service in preparation for sending a DataItem mGoogleApiClient.BlockingConnect(Constants.CONNECTION_TIME_OUT_MS, TimeUnit.Milliseconds); // Get the geofence ID triggered. Note that only one geofence can be triggered at a time in this example, but in some cases // you might want to consider the full list of geofences triggered String triggeredGeofenceId = LocationClient.GetTriggeringGeofences(intent) [0].RequestId; // Create a DataItem with this geofence's id. The wearable can use this to create a notification PutDataMapRequest putDataMapRequest = PutDataMapRequest.Create(Constants.GEOFENCE_DATA_ITEM_PATH); putDataMapRequest.DataMap.PutString(Constants.KEY_GEOFENCE_ID, triggeredGeofenceId); if (mGoogleApiClient.IsConnected) { WearableClass.DataApi.PutDataItem( mGoogleApiClient, putDataMapRequest.AsPutDataRequest()).Await(); } else { Log.Error(Constants.TAG, "Failed to send data item: " + putDataMapRequest + " - disconnected from Google Play Services"); } mGoogleApiClient.Disconnect(); } else if (Geofence.GeofenceTransitionExit == transitionType) { // Delete the data item when leaving a geofence region mGoogleApiClient.BlockingConnect(Constants.CONNECTION_TIME_OUT_MS, TimeUnit.Milliseconds); WearableClass.DataApi.DeleteDataItems(mGoogleApiClient, Constants.GEOFENCE_DATA_ITEM_URI).Await(); mGoogleApiClient.Disconnect(); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.SetSoftInputMode(SoftInput.AdjustPan); ContentView = new MainView(this); SetContentView(ContentView); LocationClient = new LocationClient(ContentView.MapView); if (IsMarshmallow) { RequestPermissions(Permissions); } else { OnPermissionsGranted(); } PointClient = new PointClient(ContentView.MapView); var bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.icon_pin_red); PointClient.Bitmap = BitmapUtils.CreateBitmapFromAndroidBitmap(bitmap); bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.icon_banner_info); // Scale down, as our original image is too large int size = (int)(20 * ContentView.Density); bitmap = Bitmap.CreateScaledBitmap(bitmap, size, size, false); PointClient.PointListener.LeftImage = BitmapUtils.CreateBitmapFromAndroidBitmap(bitmap); PointClient.QueryPoints(delegate { }); MapListener = new MapClickListener(); List <Data> items = SQLClient.Instance.GetAll(); if (items.Count > 0) { ShowSyncAlert(items.Count); } }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Data Collection"; ContentView = new MainView(); View = ContentView; LocationManager = new LocationManager(); LocationClient = new LocationClient(ContentView.MapView); PointClient = new PointClient(ContentView.MapView); PointClient.Bitmap = BitmapUtils.CreateBitmapFromUIImage(UIImage.FromFile("icon_pin_red.png")); MapListener = new MapClickListener(); string text = "QUERYING POINTS..."; ContentView.Banner.SetLoadingText(text, false); List <Data> items = SQLClient.Instance.GetAll(); if (items.Count > 0) { ShowSyncAlert(items.Count); } PointClient.QueryPoints(delegate { InvokeOnMainThread(delegate { ContentView.Banner.Hide(); }); }); var image = UIImage.FromFile("icon_banner_info.png"); image = ImageUtils.Resize(image, 70.0f); PointClient.PointListener.LeftImage = BitmapUtils.CreateBitmapFromUIImage(image); }
private async Task <List <Location> > GenerateLocationsAndLinkToRegions() { var regionDictionary = new Dictionary <int, ICollection <int> >(); //RegionsRegionIdLocationsCodesAsync returns a LIST of locationIds. foreach (var region in Db.Region) { regionDictionary[region.Id] = await LocationClient.RegionsRegionIdLocationsCodesAsync(region.JustinId.ToString()); } //Reverse the dictionary and flatten. var locationToRegion = new Dictionary <string, int>(); foreach (var(region, locationId) in regionDictionary.SelectMany(region => region.Value.Select(locationId => (region, locationId)))) { locationToRegion[locationId.ToString()] = region.Key; } var locationWithoutRegion = new List <Location>(); var locations = await LocationClient.LocationsAsync(null, true, false); var locationsDb = locations.SelectToList(loc => { var regionId = locationToRegion.ContainsKey(loc.ShortDesc) ? locationToRegion[loc.ShortDesc] : null as int?; var location = new Location { JustinCode = loc.ShortDesc, Name = loc.LongDesc, AgencyId = loc.Code, RegionId = regionId, CreatedById = User.SystemUser }; //Some locations don't have a region, this should be fixed in the JC-Interface. if (regionId == null) { locationWithoutRegion.Add(location); } return(location); }); locationsDb = AssociateLocationToTimezone(locationsDb); Logger.LogDebug("Locations without a region: "); Logger.LogDebug(JsonConvert.SerializeObject(locationWithoutRegion)); return(locationsDb); }
void SetLocationUpdateEnabled(bool enabled) { if (currentRequest != ConnectionUpdateRequest.None) { return; } currentRequest = enabled ? ConnectionUpdateRequest.Start : ConnectionUpdateRequest.Stop; if (client == null) { client = new LocationClient(this, this, this); } if (!(client.IsConnected || client.IsConnecting)) { client.Connect(); } if (enabled) { TripDebugLog.StartBikeTrip(); } }
public LocationServiceClient GetLocationServiceClient() { if (client == null) { string hostName = "localhost"; string port = "8733"; //System.ServiceModel.Channels.Binding wsBinding = new BasicHttpBinding(); //string url = // string.Format("http://{0}:{1}/LocationServices/Locations/LocationService", // hostName, port); //EndpointAddress endpointAddress = new EndpointAddress(url); //if (client != null) //{ // if (client.State == CommunicationState.Opened) // { // client.Close(); // } //} //client = new LocationServiceClient(wsBinding, endpointAddress); LocationClient locClient = new LocationClient(hostName, port); client = locClient.InnerClient; Debug.Log("LocationCallbackClient"); callBack = new LocationCallbackClient(hostName, "8734"); callBack.LocAlarmsReceved += CallBack_LocAlarmsReceved; bool r = callBack.Connect(); Debug.Log("Connect:" + r); if (r == false) { Debug.LogError(callBack.Exception.ToString()); } else { } } return(client); }
protected override void OnElementChanged(ElementChangedEventArgs <MyBaiduMap> e) { base.OnElementChanged(e); if (e.OldElement == null) { mMapView = new MapView(Forms.Context, new BaiduMapOptions()); mBaiduMap = mMapView.Map; this.SetNativeControl(mMapView); mBaiduMap.MyLocationEnabled = true; // 定位初始化 mLocClient = new LocationClient(Forms.Context); mLocClient.RegisterLocationListener(this); LocationClientOption option = new LocationClientOption(); option.OpenGps = true; // 打开gps option.CoorType = "bd09ll"; // 设置坐标类型 option.ScanSpan = 1000; mLocClient.LocOption = option; mLocClient.Start(); } }
public LocationServiceImpl(BMap.MapView mapView, Context context) { this.mapView = mapView; LocationClientOption option = new LocationClientOption(); option.SetLocationMode(LocationClientOption.LocationMode.HightAccuracy); option.CoorType = "bd09ll"; // gcj02 by default option.ScanSpan = 1000; // 0 by default(just once) option.SetIsNeedAddress(false); // false by default option.OpenGps = true; // false by default option.LocationNotify = true; // false by default option.SetIsNeedLocationDescribe(false); // 通过 getLocationDescribe 获取语义化结果 option.SetIsNeedLocationPoiList(false); // 通过 getPoiList 获取 option.IsIgnoreKillProcess = false; option.IsIgnoreCacheException = false; option.SetEnableSimulateGps(false); option.LocationNotify = true; native = new LocationClient(context); native.LocOption = option; native.RegisterLocationListener(this); }
public LocationServiceImpl(BMap.MapView mapView, Context context) { this.mapView = mapView; LocationClientOption option = new LocationClientOption(); //option.SetLocationMode(LocationClientOption.LocationMode.HightAccuracy); //option.CoorType = "bd09ll"; // gcj02 by default //option.ScanSpan = 1000; // 0 by default(just once) //option.SetIsNeedAddress(false); // false by default //option.OpenGps = true; // false by default //option.LocationNotify = true; // false by default //option.SetIsNeedLocationDescribe(false); // 通过 getLocationDescribe 获取语义化结果 //option.SetIsNeedLocationPoiList(false); // 通过 getPoiList 获取 //option.IsIgnoreKillProcess = false; //option.IsIgnoreCacheException = false; //option.SetEnableSimulateGps(false); //option.LocationNotify = true; option.SetLocationMode(LocationClientOption.LocationMode.HightAccuracy); //可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 option.CoorType = "bd09ll"; //可选,默认gcj02,设置返回的定位结果坐标系 int span = 1000; option.ScanSpan = span; //可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的 option.SetIsNeedAddress(true); //可选,设置是否需要地址信息,默认不需要 option.OpenGps = true; //可选,默认false,设置是否使用gps option.LocationNotify = true; //可选,默认false,设置是否当GPS有效时按照1S/1次频率输出GPS结果 option.SetIsNeedLocationDescribe(true); //可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近” option.SetIsNeedLocationPoiList(true); //可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到 option.SetIgnoreKillProcess(false); //可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死 option.SetIgnoreCacheException(false); //可选,默认false,设置是否收集CRASH信息,默认收集 option.EnableSimulateGps = false; //可选,默认false,设置是否需要过滤GPS仿真结果,默认需要 option.SetEnableSimulateGps(false); option.LocationNotify = true; native = new LocationClient(context); native.LocOption = option; native.RegisterLocationListener(this); }
public AddSightingWizard(LocationClient locations, FlightClient flights, AirlineClient airlines, ManufacturerClient manufacturers, ModelClient models, AircraftClient aircraft, SightingClient sightings, IOptions <AppSettings> settings, ICacheWrapper cache, IMapper mapper) { _locations = locations; _flights = flights; _airlines = airlines; _manufacturers = manufacturers; _models = models; _aircraft = aircraft; _sightings = sightings; _settings = settings; _cache = cache; _mapper = mapper; }
private void Init(Context context) { Location = new LocationClient(context); Listener = new LocationListerner(); CallBack = new LocationCallBack(); Location.RegisterLocationListener(Listener); Location.RegisterLocationListener(CallBack); LocationClientOption option = new LocationClientOption(); option.AddrType = "all"; option.CoorType = "bd09ll"; option.DisableCache(true); option.Priority = LocationClientOption.NetWorkFirst; Location.LocOption = option; MapManager = new BMapManager(context); ApplicationInfo info = context.PackageManager.GetApplicationInfo(context.PackageName, PackageInfoFlags.MetaData); Api_Key = info.MetaData.GetString(API_KEY_METADATA_KEY); }
protected override void OnResume() { base.OnResume(); LocationClient.AttachIgnoreListener(); PointClient.QueryFailed += OnQueryFailed; PointClient.PointsAdded += OnPointsAdded; ContentView.Content.Done.Clicked += OnDoneClick; ContentView.Content.CameraField.Click += TakePicture; ContentView.Add.Clicked += OnAddLocationClick; ContentView.Done.Clicked += OnLocationChosen; ContentView.Cancel.Clicked += OnLocationChoiceCancelled; ContentView.Popup.Closed += OnPopupClosed; ContentView.MapView.MapEventListener = MapListener; MapListener.MapClicked += OnMapClicked; PointClient.PointListener.Click += OnPointClicked; }
public void Connect() { locClient_ = new LocationClient (App.Inst, this, this); locClient_.Connect (); }
protected override void PlatformSpecificStart(MvxLocationOptions options) { if (_locationClient != null) throw new MvxException("You cannot start MvxLocation service more than once"); if (GooglePlayServicesUtil.IsGooglePlayServicesAvailable(Context) != ConnectionResult.Success) throw new MvxException("Google Play Services are not available"); _locationRequest = LocationRequest.Create(); _locationRequest.SetInterval((long)options.TimeBetweenUpdates.TotalMilliseconds); _locationRequest.SetSmallestDisplacement(options.MovementThresholdInM); _locationRequest.SetFastestInterval(1000); _locationRequest.SetPriority(options.Accuracy == MvxLocationAccuracy.Fine ? LocationRequest.PriorityHighAccuracy : LocationRequest.PriorityBalancedPowerAccuracy); _locationClient = new LocationClient(Context, _connectionCallBacks, _connectionFailed); _locationClient.Connect(); }
private void EnsureStopped() { if (_locationClient == null) return; _locationClient.RemoveLocationUpdates(_locationListener); _locationClient.Disconnect(); _locationClient = null; _locationRequest = null; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Map_Layout); //get data from activity main getDataIntent (); checkGoogleMap (); locationClient = new LocationClient (this, this, this); locationClient.Connect (); drugstoreMarker (); changeType (); btDirection (); layoutSlidingTop (); }
public GeofenceManager() { _locationClient = new LocationClient(Application.Context, this, this); }
void SetLocationUpdateEnabled(bool enabled) { if (currentRequest != ConnectionUpdateRequest.None) return; currentRequest = enabled ? ConnectionUpdateRequest.Start : ConnectionUpdateRequest.Stop; if (client == null) client = new LocationClient (this, this, this); if (!(client.IsConnected || client.IsConnecting)) client.Connect (); if (enabled) TripDebugLog.StartBikeTrip (); }
public void OnDisconnected() { Log.Debug ("LocClient", "Disconnected"); client = null; // If the client was disconnected too early if (currentRequest != ConnectionUpdateRequest.None) { client = new LocationClient (this, this, this); client.Connect (); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.MapLayout); GpsManager = new GpsManager (this); GpsManager.PrepareGPS (); LocationClient = new LocationClient (this, this, this); MapViewFragment = SupportFragmentManager.FindFragmentById(Resource.Id.map) as BankEntityMapView; if (MapViewFragment == null) { MapViewFragment = new BankEntityMapView (); this.SupportFragmentManager.BeginTransaction ().Add (Resource.Id.map, MapViewFragment, MapFragmentViewName).Commit (); } ListViewFragment = SupportFragmentManager.FindFragmentByTag(ListFragmentViewName) as MapEntityListView; if (ListViewFragment == null) { ListViewFragment = new MapEntityListView (); this.SupportFragmentManager.BeginTransaction ().Add (Resource.Id.entity_list_container, ListViewFragment, ListFragmentViewName).Commit(); } FrameLayout parent = (FrameLayout)this.FindViewById (Resource.Id.entity_list_container); EntityListSlider = new ViewPager (this); EntityListSlider.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); EntityListSlider.Id = EntityListSliderId; EntityListSlider.Adapter = new EntityViewPageAdapter (this.SupportFragmentManager); parent.AddView (EntityListSlider); ((TextView)this.FindViewById (Resource.Id.state_button)).Click += delegate { ToggleState(); }; MapOptions = new Options(SelectAtms, SelectBranches, DontSelectPartnerAtms); }
public void Connect() { locClient_ = new LocationClient(App.Inst, this, this); locClient_.Connect(); }