Ejemplo n.º 1
0
        private async Task _creareBazaDateFirebase()
        {
            _listaExportata.Visibility = ViewStates.Invisible;
            var _fireBD        = new FirebaseClient(_linkBDFirebase);
            var _valoriCurente = await _fireBD.Child("Coordonate curente GPS").OnceAsync <CoordonateGPS>();

            _listaAdrese.Clear();
            _export = null;
            foreach (var _valCurenta in _valoriCurente)
            {
                CoordonateGPS _gps = new CoordonateGPS()
                {
                    IDCoordonate       = _valCurenta.Key,
                    Latitudine         = _valCurenta.Object.Latitudine,
                    Longitudine        = _valCurenta.Object.Longitudine,
                    DataCurentaLocatie = _valCurenta.Object.DataCurentaLocatie,
                    AdresaLocatie      = _valCurenta.Object.AdresaLocatie
                };
                _listaAdrese.Add(_gps);
            }
            _export = new Export(this, _listaAdrese);
            _export.NotifyDataSetChanged();
            _listaExportata.Adapter    = _export;
            _listaExportata.Visibility = ViewStates.Visible;
        }
Ejemplo n.º 2
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;

            Toast.MakeText(this, "Use this activity to determine your last location and print the coordinates in the textfields " +
                           " along with the possibility to save and export them from cloud in a listview and make a quick phone call in case of " +
                           " emergency!", ToastLength.Long).Show();
            SetContentView(Resource.Layout.GPS);
            gpsTool = FindViewById <Toolbar>(Resource.Id.gpsToolbar);
            SetActionBar(gpsTool);
            latEdit         = FindViewById <EditText>(Resource.Id.seeLatitude);
            longEdit        = FindViewById <EditText>(Resource.Id.seeLongitude);
            dataGPS         = FindViewById <EditText>(Resource.Id.dateGPS);
            tvAddress       = FindViewById <TextView>(Resource.Id.tvAddress);
            gpsProgress     = FindViewById <ProgressBar>(Resource.Id.gpsProgressBar);
            _listaExportata = FindViewById <ListView>(Resource.Id.cardExport);

            _listaExportata.ItemClick += (s, e) =>
            {
                CoordonateGPS _coo = _listaAdrese[e.Position];
                _coordGPS      = _coo;
                latEdit.Text   = _coo.Latitudine;
                longEdit.Text  = _coo.Longitudine;
                dataGPS.Text   = _coo.DataCurentaLocatie;
                tvAddress.Text = _coo.AdresaLocatie;
            };
            gpsTool.MenuItemClick += _optiuniGPS;
            MapFragment _mapa = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.gpsFragment);

            _mapa.GetMapAsync(this);
            _locatie = (LocationManager)GetSystemService(LocationService);
            Criteria _criteriu = new Criteria {
                Accuracy = Accuracy.Fine
            };

            _sursaLocatie = _locatie.GetBestProvider(_criteriu, true);

            await _creareBazaDateFirebase();
        }
Ejemplo n.º 3
0
        private async void _salveazaInFirebase()
        {
            var _gps = new CoordonateGPS()
            {
                IDCoordonate       = string.Empty,
                Latitudine         = latEdit.Text,
                Longitudine        = longEdit.Text,
                DataCurentaLocatie = dataGPS.Text,
                AdresaLocatie      = tvAddress.Text
            };

            if (_gps.Latitudine != string.Empty && _gps.Longitudine != string.Empty && _gps.AdresaLocatie != string.Empty)
            {
                gpsProgress.Visibility = ViewStates.Visible;
                var _firebase = new FirebaseClient(_linkBDFirebase);
                var _topo     = await _firebase.Child("Coordonate curente GPS").PostAsync(_gps);

                gpsProgress.Visibility = ViewStates.Gone;
            }
            else
            {
                Toast.MakeText(this, "Current location not set in fields or inaccessible", ToastLength.Long).Show();
            }
        }