CIQApp - getActivityInfo() and Position.Info feeds

So I see that the GPS based ActivityInfo fields, need LocationEvents enabled in order for them to work.

What I don't understand is the use of the method function listener field use in the enable line

   function onStart(state) {
	 Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, method(:Position));
    	}

//    		function Position(info) {
//	 var gps = Position.getInfo();
//	}	

For example, 

Inside my app, I'm not using that function or that gps variable anywhere,I'm just asking getActivityInfo, and it seems to be giving it to me

This seems to be a side effect  of enabliing the sensor, rather than the right use of the listner method?

I'm using this function in my app

function compute(info)

so wouldn't it make sense to put function compute as the listener?

  • Having the callback for enableLocationEvents is really useful if you're not doing recording but you want to get the location.  An example here is a widget to get the weather, where you want the current location for the request.  Start up GPS, get the location, make the request...

    when you have GPS running and have an active session, yes, you can just get the data fro Activity.Info.

    I'd probably do your compute stuff from a timer, as you'll likely have a timer anyway to to update the screen, etc, and there could be a length of time where the callback for GPS data isn't called regularly - like when it's trying to get a GPS fix.

  • Yep, I've got it on a timer....  I also noticed ( I am doing recording ) that the GPS points that are displayed on the map in garmin connect , appear at random lengths from one another.... as if even though I have enabled continuous location, and I'm calling compute every second, it looks like sometimes it skips a second in the track log? Is that some kind of auto feature to reduce GPS useage? If so how do I disable it?>

  • When you're looking at an activity in Garmin Connect, understand there are two mode of recording on the devices.

    "Smart" and "Every second".  Every second is what you'd think - every second.

    "Smart" is when things have changed "enough" - it's to reduce the size of the .fit  and will save things only every few seconds.  If you're playing back a .fit in the sim, you probably want to make sure you're set for 1 second recording when you create the .fit. (the default on watches seems to be "smart")

    Based on your device, you set this under Settings>System>Data Recording on most.