Example #1
0
    // 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");
        }
    }
Example #2
0
    // 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);

        //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
        pedometerPlugin.RegisterSensorListener();
    }
    // 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);

        //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
        pedometerPlugin.RegisterSensorListener();
    }
Example #4
0
 private void OnApplicationPause(bool val)
 {
     if (val)
     {
         //game is pause
         //remove sensor event listener
         if (pedometerPlugin != null)
         {
             pedometerPlugin.RemoveSensorListener();
         }
     }
     else
     {
         //game is resume
         //register sensor event listener
         if (pedometerPlugin != null)
         {
             pedometerPlugin.RegisterSensorListener();
         }
     }
 }
Example #5
0
 private void OnApplicationPause(bool val)
 {
     if (val)
     {
         //game is pause
         //remove sensor event listener
         if (pedometerPlugin != null)
         {
             pedometerPlugin.RemoveSensorListener();
         }
     }
     else
     {
         //game is resume
         //register sensor event listener
         if (pedometerPlugin != null)
         {
             pedometerPlugin.ResetTotalStep();
             //register sensor event listener and pass sensor delay that you want
             pedometerPlugin.RegisterSensorListener(SensorDelay.SENSOR_DELAY_FASTEST);
         }
     }
 }