简体   繁体   中英

Google-Fit Sensor.TYPE_STEP_COUNTER equivalent in Xamarin

Given the following code in Android

private SensorManager mSensorManager = (SensorManager)        
        getSystemService(Context.SENSOR_SERVICE);
private Sensor     mStepCounterSensor = mSensorManager
        .getDefaultSensor(Sensor.TYPE_STEP_COUNTER);
private Sensor       mStepDetectorSensor = mSensorManager
        .getDefaultSensor(Sensor.TYPE_STEP_DETECTOR);

I cannot figure out the relative Xamarin.Android Code. Particularly I cannot find the equivalent of Sensor.TYPE_STEP_COUNTER and Sensor.TYPE_STEP_DETECTOR .

Trying with Sensor.StringTypeStepCounter and Sensor.StringTypeStepDetector doesn't work.

After a bit I found it out:

private SensorManager mSensorManager = (SensorManager) GetSystemService(Context.SensorService);

private Sensor mStepCounterSensor = mSensorManager.GetDefaultSensor(SensorType.StepCounter);

private Sensor mStepDetectorSensor = mSensorManager.GetDefaultSensor(SensorType.StepDetector);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM