Forum Cross Platform with Xamarin

Background Data to Content Page

I have a problem I have a Background Service where I read data from Sensors (Android). Now I need the data from the Sensor at a ContenPage in PLC
but I dont know how can I send the data to PLC

` public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        az = new Azimut();
        sd = new StepDetector(obererSchwellenWert, untererSchwellenWert, timerFlag, false);
        //Start der Sensoren
        Task.Run(() =>

            var mSensorManager = (SensorManager)Application.Context.GetSystemService(Context.SensorService);
            var mLinearAccelerometer = mSensorManager.GetDefaultSensor(SensorType.LinearAcceleration);
            mSensorManager.RegisterListener(sd, (Sensor)mLinearAccelerometer, SensorDelay.Fastest);
            var mAzimutMagneticField = mSensorManager.GetDefaultSensor(SensorType.MagneticField);
            mSensorManager.RegisterListener(az, (Sensor)mAzimutMagneticField, SensorDelay.Normal);
            var mAzimutAccelerometer = mSensorManager.GetDefaultSensor(SensorType.Accelerometer);
            mSensorManager.RegisterListener(az, (Sensor)mAzimutAccelerometer, SensorDelay.Normal);

        //Listener für Schritte
        Task.Run(() =>
            while (true)
//I need this Data
                if (sd.schritt)
                    Console.WriteLine(i+++": "+az.azimut);

                    sd.schritt = false;
        return StartCommandResult.Sticky;

this is my Background Service

Sign In or Register to comment.