Example #1
0
    //Needs check for IsSupportedSensor when display initialized
    private void InitDisplayNeedIsSupport()
    {
#if !UNITY_EDITOR && UNITY_ANDROID
        if (displaySignificantMotion != null)
        {
            displaySignificantMotion.text = "SignificantMotion : " + (AndroidPlugin.IsSupportedSensor(SensorType.SignificantMotion) ? "(supported)" : "(not supported)");
        }
        if (displayStepDetector != null)
        {
            displayStepDetector.text = "StepDetector : " + (AndroidPlugin.IsSupportedSensor(SensorType.StepDetector) ? "(supported)" : "(not supported)");
        }
        if (displayHeartRate != null)
        {
            if (!AndroidPlugin.CheckPermission("android.permission.BODY_SENSORS"))
            {
                displayHeartRate.text = "HeartRate : (permission denied)";
            }
            else
            {
                displayHeartRate.text = "HeartRate : " + (AndroidPlugin.IsSupportedSensor(SensorType.HeartRate) ? "(supported)" : "(not supported)");
            }
        }
        if (displayStationaryDetect != null)
        {
            displayStationaryDetect.text = "StationaryDetect : " + (AndroidPlugin.IsSupportedSensor(SensorType.StationaryDetect) ? "(supported)" : "(not supported)");
        }
        if (displayMotionDetect != null)
        {
            displayMotionDetect.text = "MotionDetect : " + (AndroidPlugin.IsSupportedSensor(SensorType.MotionDetect) ? "(supported)" : "(not supported)");
        }
        if (displayHeartBeat != null)
        {
            displayHeartBeat.text = "HeartBeat : " + (AndroidPlugin.IsSupportedSensor(SensorType.HeartBeat) ? "(supported)" : "(not supported)");
        }
        if (displayLowLatencyOffbodyDetect != null)
        {
            displayLowLatencyOffbodyDetect.text = "LowLatencyOffbodyDetect : " + (AndroidPlugin.IsSupportedSensor(SensorType.LowLatencyOffbodyDetect) ? "(supported)" : "(not supported)");
        }

        if (displayTest != null && testSensorTypeInt > 0)
        {
            displayTest.text = testSensorTypeInt + " : " + (AndroidPlugin.IsSupportedSensor(testSensorTypeInt) ? "(supported)" : "(not supported)");
        }
#endif
        //Unity built-in
        if (displayInputGyro != null)
        {
            Input.gyro.enabled = true;
        }

        if (displayInputCompass != null)
        {
            Input.compass.enabled = true;
        }
    }