Dear all,
I would like to develop a DataField which need to use the GPS. For this I use Visual Studio Code.
I use the following code in compute() function. It works perfectly with timerTime, altitude, currentSpeed, currentHeartRate. However info.currentLocation always returns null.
Where am I wrong?
Thank you in advanced,
Pascal
function compute(info as Activity.Info) as Void {
// See Activity.Info in the documentation for available information.
if(info has :currentLocation){
if(info.currentLocation != null)
{
var myLocation = info.position.toDegrees();
mLat = myLocation[0];
mLon = myLocation[1];
if (mLat0 == 180) // On considère dans ce cas que le GPS n'est toujours pas initialisé
{
mLat0 = mLat;
mLon0 = mLon;
}
} else
{
}
}
System.println(info.timerTime);
System.println(info.altitude);
System.println(info.currentSpeed);
System.println(info.currentLocation);
System.println(info.currentHeartRate);
System.println(mLat0);
}