I'm a bloody beginner and I'd like to return the data from a web request:
import Toybox.Activity;
import Toybox.Lang;
import Toybox.Time;
import Toybox.WatchUi;
class AareTempView extends WatchUi.SimpleDataField {
// Set the label of the data field here.
function initialize() {
SimpleDataField.initialize();
label = "°C";
}
// The given info object contains all the current workout
// information. Calculate a value and return it in this method.
// Note that compute() and onUpdate() are asynchronous, and there is no
// guarantee that compute() will be called before onUpdate().
function compute(info as Activity.Info) as Numeric or Duration or String or Null {
// See Activity.Info in the documentation for available information.
return „water temperature from url https://aareguru.existenz.ch/v2018/current?city=thun&version=1.0.42&values=aare.temperature“;
}
}
I've heard that it's only possible with a background service, but I don't how to combine the code above with the following samples (JSON, backgrounding):
https://developer.garmin.com/connect-iq/core-topics/https/
https://developer.garmin.com/connect-iq/core-topics/backgrounding/
Is anyone interested in helping a non information scientist?
Watch: Instinct 2 Solar Surf Edition