Esempio n. 1
0
        void HomeFragment_CurrentLocation(object sender, LocationCallBackHelper.OnLocationCapturedEventArgs e)
        {
            mLastLocation = e.Location;
            mLastLatLng   = new LatLng(mLastLocation.Latitude, mLastLocation.Longitude);

            if (AvailabilityListener != null)
            {
                AvailabilityListener.UpDateLocation(mLastLocation);
            }

            if (availabilityStatus && AvailabilityListener == null)
            {
                TakeDriverOnline();
            }
            if (status == "ACCEPTED")
            {
                //Update and Animate driver movement to pick up location
                LatLng pickupLatLng = new LatLng(newRideDetails.PickupLat, newRideDetails.PickupLng);
                mapHelper.UpdateMovement(mLastLatLng, pickupLatLng, "Rider");

                //update location in riderrequest table, so that rider can recieve updates
                newTripEventListener.UpdateLocation(mLastLocation);
            }
            else if (status == "ARRIVED")
            {
                newTripEventListener.UpdateLocation(mLastLocation);
            }
            else if (status == "ONTRIP")
            {//Update and animate driver movement to destination
                LatLng destinationLatLng = new LatLng(newRideDetails.DestinationLat, newRideDetails.DestinationLng);
                mapHelper.UpdateMovement(mLastLatLng, destinationLatLng, "Destination");

                newTripEventListener.UpdateLocation(mLastLocation);
            }
        }
Esempio n. 2
0
        private void LocationCallBack_CurrentLocation(object sender, LocationCallBackHelper.OnLocationCapturedEventArgs e)
        {
            Console.WriteLine($"Latitude {e.location.Latitude}  Longitude: {e.location.Longitude}");

            Dictionary <string, object> data = new Dictionary <string, object>();

            data.Add("Latitude", lastLocation.Latitude.ToString());
            data.Add("Longitude", lastLocation.Longitude.ToString());
            CrossCloudFirestore
            .Current
            .Instance
            .Collection("LOCATION")
            .Document(FirebaseAuth.Instance.CurrentUser.Uid)
            .UpdateAsync(data);

            //lastLocation = e.location;
            //Dictionary<string, object> data = new Dictionary<string, object>();
            //if (SendAlert)
            //{
            //if (CurrentKey == "X")
            //{
            //    Dictionary<string, object> data = new Dictionary<string, object>();
            //    data.Add("Latitude", lastLocation.Latitude.ToString());
            //    data.Add("Longitude", lastLocation.Longitude.ToString());
            //    data.Add("Uid", FirebaseAuth.Instance.CurrentUser.Uid);
            //    data.Add("TimeDate", FieldValue.ServerTimestamp);
            //    var dbref = await CrossCloudFirestore
            //        .Current
            //        .Instance
            //        .Collection("EMERGENCY")
            //        .AddAsync(data);
            //    CurrentKey = dbref.Id;

            //}
            //else
            //{
            //    data.Add("Latitude", lastLocation.Latitude.ToString());
            //    data.Add("Longitude", lastLocation.Longitude.ToString());
            //    data.Add("LastTimeStamp", FieldValue.ServerTimestamp);
            //    await CrossCloudFirestore
            //        .Current
            //        .Instance
            //        .Collection("EMERGENCY")
            //        .Document(CurrentKey)
            //        .UpdateAsync(data);


            //}
            //SendAlert = false;
            // }
        }
Esempio n. 3
0
        void MLocationCallback_MyLocation(object sender, LocationCallBackHelper.OnLocationCapturedEventArgs e)
        {
            mLastlocation = e.Location;

            //update our last location on the map
            LatLng myposition = new LatLng(mLastlocation.Latitude, mLastlocation.Longitude);

            mainMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(myposition, 15));

            //send location to mainActivity
            CurrentLocation?.Invoke(this, new OnLocationCapturedEventArgs {
                Location = e.Location
            });
        }