Hello there,
I've made a dataField app which does a background task (fetching a Json)
The thing I want is to delete temporal events on the exit for forcing the reloading of the Json at every app start.
Here is my current AppBase
using Toybox.Application as App;
using Toybox.Background;
using Toybox.System as Sys;
using Toybox.WatchUi as Ui;
var bgdata=null;
var url;
(:background)
class KronosApp extends App.AppBase {
	var inBackground=false;
	
    function initialize() {
        AppBase.initialize();
        url = "https://jsonplaceholder.typicode.com/todos/1";
    	if(Toybox.System has :ServiceDelegate) {
    		Background.registerForTemporalEvent(new Time.Duration(5 * 60));
    	} else {
    		Sys.println("****background not available on this device****");
    	}       
     }
    // onStart() is called on application start up
    function onStart(state) { 
    }
    // onStop() is called when your application is exiting
    function onStop(state) {
    	if(!inBackground) {
    		Background.deleteTemporalEvent();
    	}
    }
    
    //! Return the initial view of your application here
    function getInitialView() {
    	var Kview = new KronosView();
        return [ Kview ];
    }
    
    //store json data in bgdata
    function onBackgroundData(data) {
        bgdata=data;
        Ui.requestUpdate();
    }    
    function getServiceDelegate(){
 		inBackground=true;
        return [new JsonBackground()];
    }
}
Thanks in advance
 
				 
		 
					 
				