Turn GPS off and on during activity

Hello all,

I have a noobie question again:

Is it possible to start an activity with gps recording, turn the gps off at the second session lap with Position.enableLocationEvents(Position.LOCATION_DISABLE, method(:onPosition)); and turn it back on at lap three with Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, method(:onPosition)); ?

I mean will the third lap recorded correctly with map etc?

Best
Winder
  • I tried something like this not long ago, just to see if it worked. In my test case, I'd enable GPS, start recording, then turn it off, turn it back on a few minutes later, turn it off after a bit, and continue to do this over time (To see if I could save battery life)

    The result was the .fit only had the initial GPS data, and none after that, and the distances were based on stride, and not on GPS. I stopped testing it after that.
  • Thats what I assumed... Sad, but thank you Jim.

    My problem is, that I try to record football matches. In the halftime (second lap in a session) the players often go into the locker room where the GPS ofcourse not work properly. So it would be nice to just turn it off in lap 2 and turn it back on in lap 3 (second half)...

    For that, is it possible to give the activities names? I mean, when I save two different activities (lap one and three) can I write "halftime 1" and "halftime 2"?
  • Former Member
    Former Member over 8 years ago
    I would really expect this type of activity to work as you expected it to. I'd encourage you to try it out and report back here if it does not. If it does not work, I will create a ticket to figure out why it does not. Jim, if you already have an app that can do this, we could use it to investigate.
  • Brian, The project I did the testing with as long since morphed into something else, but I'll see if I can find an old backup, or maybe just do something with the ActivityRecording sample..
  • Former Member
    Former Member over 8 years ago
    Hello all,

    I have a noobie question again:

    Is it possible to start an activity with gps recording, turn the gps off at the second session lap with Position.enableLocationEvents(Position.LOCATION_DISABLE, method(:onPosition)); and turn it back on at lap three with Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, method(:onPosition)); ?

    I mean will the third lap recorded correctly with map etc?

    Best
    Winder


    Hello Winder,

    You don't say what device u r using? I do this all the time with my FR310XT and wearing HRM. I get satellites, press START and run to the gym. At gym press STOP. That automatically creates Lap1. Turn off GPS and press START. The 310 records HR during workout. Go outside and press STOP. That automatically creates Lap2. Turn on GPS and wait for satellites, press START and run home. Press STOP and that automatically creates Lap3. Both runs (lap1 and Lap3) show on the map and all 3 graphs show when plotted over "Time".

    For your football session you would just press STOP at halftime (creates Lap1) and then after u r back on the field press START to record second half as Lap2.
  • Hi all,

    thanks for your answers.

    Brian, I tried to turn it off and simulate it. The simulator still records the GPS data even when GPS is disabled.

    On my Vivoactive it seems GPS will turned off correctly. I will try this outdor this day. Especially the "turn back function and map recording.

    I will come back to this today evening.

    Best
    Winder
  • Former Member
    Former Member over 8 years ago
    I'm not surprised by your experience in the simulator. It of course doesn't actually have GPS, and I don't think the app is able to start and stop the simulation in the same way the GPS is started and stopped on devices when registering/unregistering from positioning events. I hope your device test goes well.
  • Ok, I stand corrected. I couldn't dig up the version of the app I first saw this in, so I put together a modified version of the RecordSample. It fires up GPS and then turns it off 4 minutes into the recording. Later, with a button press, it fires up GPS for another 4 minutes, and so on (I display the lat/lon from both onPosition and from activity.Info.currectPostion to verify the starts and stops).

    Went for a walk with a normal recording app (GPS on the whole time), and fired up GPS a few times along the way in the test app (I had more than one watch for this test). I can see the 4 minutes of GPS at the times I fired up GPS, with a straight line connecting them. (which is what I'd expect)

    The only odd thing I saw was the recording with GPS on all the time had a distance of 1.29 miles, while the one with the on/off GPS had 2.03 miles. Not sure if this is the result of switching between GPS distance and stride length distance, or if it's using the "straight line" distance when GPS is off.

    It could be when I first tested this, I didn't fire up GPS for enough time during the recording. Maybe I'll try again with GPS on for 15 seconds or something...

    Running the modified app in the sim didn't do things the same way as on the watch, but like Brian, I'm not surprised as it's really a different environment. GPS doesn't really get turned off (current postion in Activity.Info continues to change when GPS is off there for example, and the .fit written there might still have the data while GPS is off - I didn't bother to look at the .fit written by the sim)
  • Hey,

    sorry, it took a bit longer than i expected to do my testwalk.

    I was out with my son, so no running or something like that :)

    It works as i thought it would. It turnes the gps off and on and goes on recording the map data. The only thing i don't really like is the straight line on the map between 10:06 (GPS turned off) and 17:28(GPS turned back on). But I am not sure it is possible without this line:
    https://connect.garmin.com/modern/activity/1484461875

    Ps. That the simulator won't do it that way was clear for me. Just wanted to say that in my last post.

    Best
    Winder
  • Former Member
    Former Member over 8 years ago
    Hey,
    The only thing i don't really like is the straight line on the map between 10:06 (GPS turned off) and 17:28(GPS turned back on). But I am not sure it is possible without this line:


    Hello Winder,

    You will always get that straight line when the STOP and START are in different places because it connects the coordinates together.
    For your football session you can eliminate that straight line if you press STOP near your bench and then press START after you return to the bench (or some other convenient spot). You should not have to turn the GPS off.