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(); } }
protected override void OnResume() { base.OnResume(); Log.Debug("OnResume", "OnResume called, connecting to client..."); locClient.Connect(); // Clicking the first button will make a one-time call to get the user's last location button.Click += delegate { if (locClient.IsConnected) { button.Text = "Getting Last Location"; if (locClient.LastLocation != null) { Location location = locClient.LastLocation; latitude.Text = "Latitude: " + location.Latitude.ToString(); longitude.Text = "Longitude: " + location.Longitude.ToString(); provider.Text = "Provider: " + location.Provider.ToString(); Log.Debug("LocationClient", "Last location printed"); } } else { Log.Info("LocationClient", "Please wait for client to connect"); } }; // Clicking the second button will send a request for continuous updates button2.Click += delegate { if (locClient.IsConnected) { button2.Text = "Requesting Location Updates"; // Setting location priority to PRIORITY_HIGH_ACCURACY (100) locRequest.SetPriority(100); // Setting interval between updates, in milliseconds // NOTE: the default FastestInterval is 1 minute. If you want to receive location updates more than // once a minute, you _must_ also change the FastestInterval to be less than or equal to your Interval locRequest.SetFastestInterval(500); locRequest.SetInterval(1000); Log.Debug("LocationRequest", "Request priority set to status code {0}, interval set to {1} ms", locRequest.Priority.ToString(), locRequest.Interval.ToString()); // pass in a location request and LocationListener locClient.RequestLocationUpdates(locRequest, this); // In OnLocationChanged (below), we will make calls to update the UI // with the new location data } else { Log.Info("LocationClient", "Please wait for Client to connect"); } }; }
public void Start(DateTime startTime, DateTime endTime) { isReporting = true; locationErrorCount = 0; this.startTime = startTime; this.endTime = endTime; lastTime = DateTime.Now; mLocationClient.Connect(); }
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(); } }
private async void button_initiate_Click(object sender, EventArgs e) { string ip = textBox_ip.Text; int port = (int)numeric_port.Value; try { await locClient.Connect(ip, port); ReceiveMessages(); groupBox_initiate.Enabled = false; groupBox_server.Enabled = true; } catch (FormatException) { MessageBox.Show("Ip format is not correct"); } catch (System.Net.Sockets.SocketException) { MessageBox.Show("Wrong host Ip"); } }
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 void OnStart() { mLocationClient.Connect(); }
public void Connect() { locClient_ = new LocationClient(App.Inst, this, this); locClient_.Connect(); }
public void Start() { _locationClient.Connect(); }
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 (); }
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(); }
public void Connect() { locClient_ = new LocationClient (App.Inst, this, this); locClient_.Connect (); }