I'm encountering a problem when trying to make my app exit in a timer callback.
If I implement my view delegate to exit app when pushing a button:
using Toybox.WatchUi as Ui;
class HomeDelegate extends Ui.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
function onSelect() {
Toybox.System.exit();
}
}
The exit log looks fine:
Found Transport: tcp
Connecting...
Connecting to device...
Device Version 0.1.0
Device id 1 name "A garmin device"
Shell Version 0.1.0
Copying file.... 2% complete
Copying file.... 4% complete
Copying file.... 96% complete
Copying file.... 98% complete
Copying file.... 100% complete
File pushed successfully
Connection Finished
Closing shell and port
Found Transport: tcp
Connecting...
Connecting to device...
Device Version 0.1.0
Device id 1 name "A garmin device"
Shell Version 0.1.0
Complete
Connection Finished
Closing shell and port
But when after pushing a button I want to start a timer that exits in a timer callback:
using Toybox.WatchUi as Ui;
class HomeDelegate extends Ui.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
function onSelect() {
var t = new Timer.Timer();
t.start(method(:dostuff), 1000, false);
}
function dostuff() {
Toybox.System.exit();
}
}
There is always an error in the log - without any specific information
Copying file.... 98% complete
Copying file.... 100% complete
File pushed successfully
Connection Finished
Closing shell and port
Found Transport: tcp
Connecting...
Connecting to device...
Device Version 0.1.0
Device id 1 name "A garmin device"
Shell Version 0.1.0
Error in timer callback
Complete
Connection Finished
Closing shell and port
Can someone please help me out? What can be the cause for this error?
Is there any way around this?