Hi, I am trying to create a datafield that fetches data from an HTTP server. I have followed some examples published here on the forum and has created a datafield that fires off a background process (every 5 mins) to connect to the web server. It works good
However, I would like it to run the background process instantly when i start/initiate the datafield. Now it takes up to 5 mins before it executes the background process. Is there a way to get the background process to execute immediately?
I'm using the registerFor TempralEvent call in the getInitialView function:
function getInitialView() { var url = (App.getApp()).getProperty("Url"); //debug Sys.println("URL = "+(App.getApp()).getProperty("Url")); if((Toybox.System has :ServiceDelegate) && (url != null) && !url.equals("")) { canDoBG=true; //remove any previously registered events Background.deleteTemporalEvent(); Background.registerForTemporalEvent(new Time.Duration(5 * 60)); }
Any ideas appreciated, thanks!
/Fredrik