The original sample was posted before the forum SW changed last April, but here it is again. (I've probably changed it slightly since then )
is there a chance something has changed, ive tried other apps and also your sample app here and I'm no longer seeing the "count" update after waiting 5 minutes (or more), the only way to get an update to be triggered is if I go into a menu or something else and come back to the watch face then the latest count will be shown.
This is on a fenix 6, various firmwares (including which was the last 9.x firmware, the current 10.x release firmware and evne the 10.75 beta firmware).
From debugging myself it seems that after background.exit is called the onbackgroundata call is never called until I interact with the watch.
I also have a vivoactive 3 which is not exhibiting this behaviour, any ideas?
It'[s a FW bug on the f6.
damn that was my bug report, was hoping it was something else
i Jim, I used the example to create my own data field with a background process (to do makewebrequest) a long while ago (it helped me a lot). Now when I return to my code I wonder if I really need to use app properties to pass data from the bg to the main application or if I could use a global variable in my app class instead? thanks!
You can not write to app properties from a background process (unless something has changed and I missed. it
The background returns data to the main app using Background.exit()
Globals are not what you think when using backgrounding.
Say you have a global
var abc=0;
in the background you can access it and change it to 123.
The main app still sees 0.
The main app and the background have their own copy of a global. Recall the background can run even if the main app isn't running
Ah, I see now. Thank you for the explanation.
This is what I have in my existing data field implementation, that works: (I think this is based on your example)
//global vars var OSDATA="osdata"; // function declared in my app class, to receive data from the BG process function onBackgroundData(data) { App.getApp().setProperty(OSDATA,data);
I thought this meant I shared data between the bg and main process through an app property. Another thing I havent been able to figure out is if "osdata" is some sort of a special property, or could I use any name I'd like?
Nothing special. It's just a sting with the key.