Best way to check for GPS signal before starting app...

Former Member
Former Member
Hi all,

I have created my own app for recording an activity (kayaking) which work flawlessly. My problem is to ensure that the GPS signal is ok before starting the recording...

I currently test it like that :


var positionInfo = Position.getInfo();

if (positionInfo.accuracy >= Position.QUALITY_USABLE){
GPSready=true;
}


How ever when I launch my app (outdoor of course)... I can wait 10mn and the GPS did not fix.

If just before launching my app, I ask my watch (VIVOACTIVE 3) to find my position (as if I wanted to record a POI)... It takes only a few seconds to have the position displayed. Then If I launch my app, it detects quickly the GPS signal and I start my recording...

I thus think that I have missed something....

my session is created with

session = Record.createSession({:name=>"Kayak", :sport=>Record.SPORT_PADDLING, :subSport=>Record.SUB_SPORT_GENERIC, :sensorLogger => mLogger });


and when the GPS is fixed my positions are logged so that I can se my track in Garmin COnnect...


Any Idea ?
  • In enableLocationEvents, I do this by way of the onPosition callback.

    In onPosition (which will be called every sec) I check the accuracy, and if it's usable or above, I set a flag that enables the start button to actually start recording the session. Until GPS is ok, the start button does nothing.

    Hike2 will show you want this looks like to a user.