So I am working on a class featuring the Position module. However, the callback method for enableLocationEvents doesn't get invoked. Any idea why?
import Toybox.Position;
using Toybox.System;
using Toybox.Time.Gregorian;
using Toybox.Lang;
class GPS{
var posInfo;
function initialize(){
System.println("Initialize is called");
}
function startPositioning() {
System.println("StartPositioning is called");
Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, method(:onPosition));
System.println("enableLocationEvents is called");
}
function onPosition(info) {
System.println("onPosition is called" + info);
posInfo = info;
}
}
I instantiate this class in the main App file in the Onstart() function to test the code:
function onStart(state as Dictionary?) as Void {
gps.startPositioning();
}
The result I get in the consol is:
Meaning that onPosition() callback method is never invoked. I would greatly appreciate it if someone could help me.
NOTE: I haven't tested it on an actual watch I am running the simulator on a vivoactive 4 and API version 3.3.6