Detecting full Mobile Sensor activation
livfoss at mac.com
Sat Apr 25 08:07:01 EDT 2020
Typical fitness apps (such as iCardio by FitDigits) can read various sensors including a Heart Rate Monitor via Bluetooth, and one’s location via inbuilt GPS. When you start an activity like a run or a workout, the app goes through an acquisition phase, and won’t start recording until the sensors are functioning. This is made clear to the user by a display.
I want to do this in my LC iOS app, specifically for the GPS. I know how to start the location function on the device and I know how to handle the position via ‘locationChanged' and/or ‘mobileCurrentLocation', and these work. The big problem is at the start of such a sequence. I can use 'mobileStartTracking Sensor “location” ’ to get going, but experience shows that this takes an unpredictable amount of time, sometimes of the order of seconds. You would think that the locationChanged messages wouldn’t start firing until the start tracking process had done its job, but it seems this is not so, and nonsense locations can appear at the beginning of the sequence. At least that’s my experience.
I am loth to use a loop to see if the tracking is really started and legit, and anyhow this would be problematical if my app was being inundated with ‘locationChanged' messages while the loop is running.
Has anyone any experience of this issue? As usual, I feel I’m missing something. Perhaps the ‘trackingError’ message might help, but I don’t see how.
More information about the use-livecode