Exemplo n.º 1
0
        void CreateLocationRequest()
        {
            locationRequest = new Android.Gms.Location.LocationRequest();
            locationRequest.SetInterval(UPDATE_INTERVAL);
            locationRequest.SetFastestInterval(FASTEST_INTERVAL);
            locationRequest.SetPriority(Android.Gms.Location.LocationRequest.PriorityHighAccuracy);
            locationRequest.SetSmallestDisplacement(DISPLACEMENT);
            locationClient                = Android.Gms.Location.LocationServices.GetFusedLocationProviderClient(this);
            mLocationCallback             = new LocationCallbackHelper();
            mLocationCallback.MyLocation += MLocationCallback_MyLocation;

            Logger.Log("Location mamager initialized. ", "locationProvider");
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            textLastLocation    = FindViewById <TextView>(Resource.Id.textLastLocation);
            textLocationUpdates = FindViewById <TextView>(Resource.Id.textLocationUpdates);

            // Create our client and location callback
            fusedClient      = new Android.Gms.Location.FusedLocationProviderClient(this);
            locationCallback = new Android.Gms.Location.LocationCallback();
        }