Vivoactive 5 stops to record GPS activity data

Hello,

I am developing a simple application to monitor inline skating activities for the Vivoactive 5 and Vivoactive HR models because these models do not have a native application for this modality.

On the Vivoactive 5, I'm experiencing an issue where activity tracking sometimes stops unexpectedly. This is frustrating because the user has to save the activity and start a new one manually. Additionally, if they overlook the issue immediately, a significant portion of the workout data is lost.

I haven't been able to reproduce what causes the problem consistently. However, one time, it occurred when a goal notification appeared. After dismissing the notification and returning to the app, the speed (KM/h) remained at zero, and the recorded distance stopped increasing. This isn't just a display issue, as saving the activity confirmed that the total recorded distance matched what was shown on screen.

To debug this, I added a GPS signal indicator to the screen. When the issue occurs, the signal status drops to POOR and never recovers to GOOD.

I also noticed that this model allows users to switch from the app to view the watch face and then return. When doing this, the app sometimes loses the GPS signal but eventually recovers. This temporary loss means activity tracking pauses until the app becomes active again, causing minor data loss. I was able to block lateral switching, but I'm unsure if it's possible to prevent other actions, such as the app going inactive when receiving a notification or when the action button is held to open the quick action menu.

I'm using ActivityRecording for activity tracking, and no calculations are done within the app. I use Positioning events solely to force screen updates and display activity data.

I checked the documentation and found a note in the Position class stating that if the app goes inactive, it will stop receiving events but should resume once it becomes active. However, in the Core Topics/Application and System Modules section, it states:

"If the app is recording an activity and receiving position events, it will continue to receive events in the inactive state. If the app is not recording an activity, it is blocked from modifying the GPS state."

Based on this, the app shouldn't lose the GPS signal when inactive—but that’s exactly what's happening.

Is there anything I can do as a developer to prevent this issue?

I noticed that the simulator has an App Lock Enable option, and I wondered if that could help, but I couldn’t find anything in the documentation about enabling it programmatically.

Has anyone else experienced this issue?

It's worth mentioning that these models don't have a native app for inline skating tracking, so I had to create one.

More information:

Min Api Level: 2.4.0
Connect IQ SDK version: 7.4.3

Some code:

// this is how i create the session
ActivityRecording.createSession({
    :name => "Patinação inline",
    :sport => Activity.SPORT_INLINE_SKATING,
    :subSport => Activity.SUB_SPORT_GENERIC,
});

// This is how I activate the sensors before creating the session and starting the activity.
function onStart(state as Lang.Dictionary?) as Void {
    Sensor.setEnabledSensors([Sensor.SENSOR_HEARTRATE]);
    Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, method(:onPosition));
}

// This is what I do at the positioning event
function onPosition(loc as Position.Info) as Void {
    WatchUi.requestUpdate();
}

  • This is funny. The question is definitely on-topic, but you say you're writing an inline skating app because there's no built-in activity, however there are multiple existing inline skating apps for your devices (some of whom I use on different devices) Just that you know, you don't have to reinvent the wheel Slight smile

  • I obviously tried to use them (including a paid one), but they didn't work for me, so I decided to create one for personal use and made it available for free in the store in case it was helpful to someone else.
    I appreciate your concern, but I'm still facing the problem described in the topic.

  • I do something similar, except my onPosition() is empty, and I have a timer that calls requestUpdate every second (my app is for hiking/walking, but sometimes I use it indoors and I still want the screen to update the steps, time, etc) BTW why do you need to enable the HR sensor? I don't have that and my app still records the standard HR fields. 

    I'll also add that maybe one non-technical thing you can do is to add some explanation about this switch to watchface issue to your FAQ and hope that people read it before giving you 1 star review...

  • I also had some GPS issues ( https://forums.garmin.com/developer/connect-iq/f/discussion/399614/how-can-i-indicate-the-gps-status-fix ) and I not only display the gps status but also record it to the fit file (UINT8)

  • One more thing I remembered: I have a fr965, and I noticed some strange behavior of the GPS connected / disconnected system notification (I don't remember the exact words) during an activity (data field). Let's say I start a walking activity while I'm still indoors or don't wait for the GPS to become green. Then I go outside and start to walk in my street (only small houses). Based on my experience if I waited for the GPS to become green before I start the activity, I would walk 10-15 meters. Sometimes I walk 100 meters or more, then I get the GPS connected notification. Or sometimes I don't get it (even though I know it has a GPS fix because I see the gps status on the screen). However 15 minutes later I go inside, and then (when logic tells me I should get the GPS disconnected notification) I get the GPS connected notification. Sometimes I think there's some bug in how the GPS dis/connection notifications are presented. Maybe it sometimes stacks the notifications and doesn't always display the most recent one.

    Also when I walk inside my house and there is obviously not good GPS reception, so the status changes every couple of seconds, then the notifications (if there is ever one) are not too much in sync with the GPS status icon (that is based on ActivityInfo.currentLocationAccuracy)

  • I read in core topics/sensor and thought it was necessary to activate it; I didn't test it without activating it to see if the hr information was recorded in the activity. I will test and remove it if it is not necessary. thanks

  • In my case, I have a screen saying, "Please wait for GPS," indicating that the activity should be started after the GPS signal is good.
    I noticed that notifications of messages or if the user holds the button and displays the quick menu cause the GPS signal to be lost. I imagine that anything that makes the App inactive on the screen also causes the GPS signal to be lost.

    I couldn't find anything I could do in the code to stop this.

    It's a shame to educate the user to activate the "do not disturb" mode when starting the activity.