Tasker: read GPS FIX status (TRUE/FALSE) or #of Sats. in the fix

323 views
Skip to first unread message

Maniac Traveller

unread,
Feb 7, 2021, 11:52:16 AM2/7/21
to Tasker

Dear all,

I wonder if there is any way to read GPS FIX status (yes/no) from the system?

Not the coordinates whatsoever, but the GPS fix True/False state OR # of Satellites in the fix.
See the screenshot, in this case GPS fix =N (# of fix sat. = 0)
Would Autolocation be of any help here?

I want to run some tasks based on this.

THANKS

Capture.PNG

Rich D

unread,
Feb 7, 2021, 5:10:06 PM2/7/21
to Tasker Google Groups Post

Sergey Dushenkov

unread,
Feb 7, 2021, 8:03:09 PM2/7/21
to tas...@googlegroups.com
Hi Rich,
Yes, found this already and testing.
On first glance should work.. But it seems to remember the last 'fix' state.

During first test I have faced the following :
Sats in view with fix >0, script works as expected,
But when I suddenly go to closed area, the last 'fix' count is kept, so instead of 0, I continue getting the last known fix state, for example, 3.

(I have packed the script in the repeating cycle, running every 2 secs) 

Will do the real test tomorrow to see how it behaves under my 'gps bug' condition, but I guess there should be sone other function/state/parameter to query for 'current sat fix', not the last known. 



On Sun, Feb 7, 2021, 23:10 Rich D <ricp...@gmail.com> wrote:
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/MzeL7NOSwDY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/CADuUTAqDMEU%3Ddme2z1P8B19kYFZiDjXo9SpwXwauzZvS4aY6LA%40mail.gmail.com.

Maniac Traveller

unread,
Feb 8, 2021, 5:30:58 AM2/8/21
to Tasker
OK, in my real test conditions it works perfectly well , 
I have packed the tasks referred above into the continuous cycle under separate task which I am triggering from parent (main profile entry task), so it runs concurrently as SAT fix monitor while parent task queries %sats variable state and triggers what I want based on it's value.

Thank you all!

p.s. maybe would be good to consider wrapping this function to become available out of the box either from within Tasker or from within AutoLocation.

João Dias

unread,
Feb 8, 2021, 6:09:19 AM2/8/21
to tas...@googlegroups.com
Ok, added to the app :) For me it's not getting any satellite data but maybe it works for you? Can you please try this version? https://drive.google.com/file/d/1SvQFvAxFwCk-hArfO_6wOH0UlvvMGi0z/view?usp=sharing

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Maniac Traveller

unread,
Feb 8, 2021, 7:53:45 AM2/8/21
to Tasker
@joaomgcd, will give it a try later today.

@Rich, All,
It seems that under certain conditions (i.e. sudden fix lost, i.e. when driving into the tunnel) it returns 'last known' count of  sats fix.
So it happens like this: 
 - open air, sat fix = 0k, #of sats >0;
- entering tunnel, sat fix is suddenly lost, #of sats returned by the script still >0 (i.e. 7, from last fix) and does not change
- exiting tunnel, sat fix restored, #od sat fix resume updating.

I believe there should be some other way/functions/parameters to call from android API to check the realtime SAT fix stats, no the 'last-known'
As well,  for example, satellites in the view (but no fix).

While it does not impact my own scenario, would be good to know for other potential use cases, so if someone could share additional details  on other parameters, would be great.

p.s.
if someone needs a ready-to-use task, here is the Taskernet link
I have modified the code slightly, so it ignores some tasks when GPS state=off, and also continues if error to avoid issues on the cold start (A3 and A4 will not work until first fix is obtained)
https://taskernet.com/shares/?user=AS35m8l0ANKH2oP0rV%2FYJD5LWXjaILiSO7ED1oAT4JS0omTK%2Bs6%2FQnkT4Sc6taOJbjcBEj2zEgNl&id=Task%3AReadSATS
Pay attention that it runs in continuous cycle until stopped, interval is controlled by Wait (A6)

   ReadSATS
    A1: Java Function [ Return:lm Class Or Object:CONTEXT Function:getSystemService
    {LocationManager} (String) Param:location Param: Param: Param: Param: Param: Param: ]
    A2: Java Function [ Return:loc Class Or Object:lm Function:getLastKnownLocation
    {Location} (String) Param:gps Param: Param: Param: Param: Param: Param: ]
    A3: Java Function [ Return:bun Class Or Object:loc Function:getExtras
    {Bundle} () Param: Param: Param: Param: Param: Param: Param: Continue Task After Error:On ] If [ %GPS ~ on ]
    A4: Java Function [ Return:%Sats Class Or Object:bun Function:get
    {Object} (String) Param:satellites Param: Param: Param: Param: Param: Param: Continue Task After Error:On ] If [ %GPS ~ on ]
    A5: [X] Flash [ Text:%Sats Long:Off ]
    A6: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
    A7: Goto [ Type:Action Number Number:1 Label: ]

Maniac Traveller

unread,
Feb 8, 2021, 8:20:06 AM2/8/21
to Tasker
@joaomgcd,

Just tested, I guess you are referring to GetLocations V2: %gl_satellites ?

Does not work for me.
I have just submitted a debug where I've  executed Getlocations V2  and Java based task  to show the difference, please check support mailbox (from Sergey)

Thank you!
On Monday, February 8, 2021 at 12:09:19 PM UTC+1 joaomgcd wrote:

João Dias

unread,
Feb 9, 2021, 9:19:29 AM2/9/21
to tas...@googlegroups.com
Hmm, the difference seems to be that you're always using the last gotten location which is not guaranteed to be recent so it won't be always reliable. Not sure how to force it to get the satellite data...

Robert Ryan

unread,
Feb 9, 2021, 10:02:46 AM2/9/21
to tas...@googlegroups.com, João Dias
Couldn't you just get a new GPS fix via Java or the Get Location action? Then that would become your "last known location". 

Then get the number of satellites from that. 

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/CAG6Z%2BFexGRXnUo_mBxEHPRkiv3siAyTVtgwiRjtSjDoN3ka6pg%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages