I'm writing my first Garmin software (a watch app) and am I'm struggling to understand if I'm doing something wrong, or if there's an issue with the FW on my watch.
I'm trying to create a view that responds to all four directions of swipe... where the right-swipe does NOT go back, but instead the user uses the (bottom right) back button to do that instead.
Based on comments by Jim in the following discussion, I've implemented the following code...
var _onBack = false; function onBack() { System.println("back"); _onBack = true; return false; } function onSwipe(evt) { var direction = evt.getDirection(); if (_onBack) { System.println(Lang.format("back behavior for swipe $1$", [ direction ])); } switch(direction) { case SWIPE_LEFT: _view.changePrimary(true); break; case SWIPE_RIGHT: _view.changePrimary(false); break; case SWIPE_UP: _view.changeSecondary(true); break; case SWIPE_DOWN: _view.changeSecondary(false); break; } return true; } function onKey(evt) { if(_onBack) { System.println(Lang.format("back behavior for key $1$", [ evt.getKey() ])); WatchUi.popView(WatchUi.SLIDE_RIGHT); } _onBack = false; return true; }
But I'm seeing major differences between the vivoactive 4 simulator and the watch itself.
On the simulator the right swipe works as expected... with the console showing: back / back behavoir for swipe 3
And the back works as expected.. with the console showing: back / back behavoir for key 5
However, on my physical watch, the right swipe AND the back have identical logs of :back / back behavoir for key 5
There doesn't seem to be a way to override the back functionality of the right-swipe on the physical device.
What am I doing wrong?