Detecting full Mobile Sensor activation
alanstenhouse at hotmail.com
Sat Apr 25 20:47:20 EDT 2020
Some ideas, from experience:
1. Start your sensor on openStack or as soon as possible.
2. Ignore locationChanged messages with empty location or if "horizontal accuracy" is outside a threshold of x metres.
3. Just set a flag or other mechanism when you want to start and stop tracking which indicates to your locationChanged handler to record or stop recording the track.
Hopefully that sounds reasonable?
> On Sat, 25 Apr 2020 14:07:01,Graham Samuel <livfoss at mac.com <mailto:livfoss at mac.com>> wrote:
> 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