コード例 #1
0
ファイル: PedometerDemo.cs プロジェクト: zhaosec/Tingo
    // Use this for initialization
    void Start()
    {
        //get the instance of pedometer plugin
        pedometerPlugin = PedometerPlugin.GetInstance();

        //set to zero to hide debug toast messages
        pedometerPlugin.SetDebug(0);

        utilsPlugin = UtilsPlugin.GetInstance();
        utilsPlugin.SetDebug(0);

        //check if step detector is supported on the current android mobile device
        bool hasStepDetector = utilsPlugin.HasStepDetector();
        bool hasStepCounter  = utilsPlugin.HasStepCounter();

        //if (hasStepDetector) {
        if (hasStepCounter)
        {
            // yehey your android mobile device support pedometer

            UpdateStepDetectorStatus("available");
            // event listeners
            AddEventListeners();
            //initialze pedometer
            pedometerPlugin.Init();
        }
        else
        {
            // if you get this meaning
            // pedometer is not available on your android mobile device sorry!
            UpdateStepDetectorStatus("not available");
        }
    }
コード例 #2
0
ファイル: PedometerDemo.cs プロジェクト: catnap-group/Catnap
    // Use this for initialization
    void Start()
    {
        //get the instance of pedometer plugin
        pedometerPlugin = PedometerPlugin.GetInstance();

        //set to zero to hide debug toast messages
        pedometerPlugin.SetDebug(0);

        utilsPlugin = UtilsPlugin.GetInstance();
        utilsPlugin.SetDebug(0);

        //check if step detector is supported
        bool hasStepDetector = utilsPlugin.HasStepDetector();

        if (hasStepDetector)
        {
            UpdateStepDetectorStatus("available");

            //initialze pedometer
            pedometerPlugin.Init();

            //set this to true to always starts at zero steps, else set to false to continue steps
            pedometerPlugin.SetAlwaysStartAtZero(true);

            //set call back listener for pedometer events
            pedometerPlugin.SetCallbackListener(OnStepCount, OnStepDetect);

            //register sensor event listener and pass sensor delay that you want
            pedometerPlugin.RegisterSensorListener(SensorDelay.SENSOR_DELAY_FASTEST);
        }
        else
        {
            UpdateStepDetectorStatus("not available");
        }
    }
コード例 #3
0
ファイル: PedometerDemo2.cs プロジェクト: zhaosec/Tingo
    // Use this for initialization
    void Start()
    {
        //get the instance of pedometer plugin
        pedometerPlugin = PedometerPlugin.GetInstance();

        //set to zero to hide debug toast messages
        pedometerPlugin.SetDebug(0);

        utilsPlugin = UtilsPlugin.GetInstance();
        utilsPlugin.SetDebug(0);

        //check if step detector is supported
        bool hasStepDetector = utilsPlugin.HasStepDetector();
        bool hasStepCounter  = utilsPlugin.HasStepCounter();

        //if (hasStepDetector) {
        if (hasStepCounter)
        {
            UpdateStepDetectorStatus("available");
            // event listeners
            AddEventListeners();
            //initialze pedometer
            pedometerPlugin.Init();
        }
        else
        {
            UpdateStepDetectorStatus("not available");
        }
    }