Detecting full Mobile Sensor activation

Graham Samuel livfoss at mac.com
Sun Apr 26 05:41:59 EDT 2020


Alan, thanks for your two messages. II’m doing most of what you suggest (not using accuracy so far, but the prudent person probably should do!), but nevertheless I would like to emulate my fitness app example. I have apps that positively know when they have acquired a meaningful GPS signal, whereas the methods i’m using contain an element of chance or guesswork. I want to completely eliminate that.

In practical terms, I can’t start the sensor until the user needs it, because of battery drain - you will find this in most trekking and fitness apps - one is more or less confined to a button ‘Start’ or something similar. At that point, my ideal would be to show the user that I’ve started the sensor acquisition and tell them when it’s succeeded or failed. I feel it has to be possible, but perhaps not with LC.

Graham


> On 26 Apr 2020, at 02:47, Alan Stenhouse <alanstenhouse at hotmail.com> wrote:
> 
> Hi Graham
> 
> 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?
> 
> cheers
> 
> Alan
> 
>> 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.
>> 
>> Graham
> 




More information about the use-livecode mailing list