Esempio n. 1
0
 // Handle location updates from the location manager
 public void StartLocationUpdates()
 {
     Log.Debug(logTag, string.Format("You are about to get location updates via {0}", "LocationManager.GpsProvider"));
     LocMgr.RequestLocationUpdates(LocationManager.GpsProvider, 1000, 0, this);
     LocMgr.AddNmeaListener(this);
     Log.Debug(logTag, "Now sending location updates");
 }
        protected override Task <Stream> OpenStreamAsync()
        {
            if (!manager.IsProviderEnabled(LocationManager.GpsProvider))
            {
                throw new InvalidOperationException("The GPS Location Provider is not enabled");
            }

            stream                = new StringStream();
            listener              = new Listener();
            listener.NmeaMessage += (s, e) => stream?.Append(e);
            bool success = manager.AddNmeaListener(listener);

            manager.RequestLocationUpdates(LocationManager.GpsProvider, 0, 0f, listener);
            return(Task.FromResult <Stream>(stream));
        }