Hello,
I need to run two temporal events for my project - the first one is for weather (every 15 minutes) which is working, but when I try to add another one for another service (5 mins) nothing works at all. I'm getting the error that it's no longer finding the location and weather (although it does find the weather in the console by natural or manual temporal events). Is there anything I can do to get them both to work with each other? This is what I've got in the .app file:-
(:background) class watchApp extends Application.AppBase { function initialize() { AppBase.initialize(); initializeSecondEvent(); } // onStart() is called on application start up function onStart(state) { } // onStop() is called when your application is exiting function onStop(state) { } // Return the initial view of your application here function getInitialView() { if (Toybox.System has :ServiceDelegate) { Background.registerForTemporalEvent(secondEventFrequency); // 5 min for 2nd event } Background.registerForTemporalEvent(new Time.Duration(900)); // 15 min for 1st event (weather) return [ new watchView() ]; } function getServiceDelegate() { return [new secondEventServiceDelegate(null, null)]; // not quite sure how to run that one return [new BackgroundService()]; //works for 1st event } function onBackgroundData(data) { secondEvent.onBackgroundData(data); var response = data[secondEvent.extraResponseKey]; if (response != null) { // handle your background response System.println(response); } if (data instanceof Dictionary) {// for first event // etc to obtain location/weather data // lines are used for the 1st event, not sure if it clashes with 2nd var type = data.keys()[0]; // Type of received data. Application.getApp().setProperty("Type", type); var storedData = Application.getApp().getProperty("Type"); var receivedData = data[type]; // The actual data received: strip away type key. storedData = receivedData; Application.getApp().setProperty("Type", storedData); // end of lines are used for the 1st event // WatchUi.requestUpdate(); } WatchUi.requestUpdate(); } // New app settings have been received so trigger a UI update function onSettingsChanged() { WatchUi.requestUpdate(); }