Hi,
I'm developing an app to record scores for indoor football (soccer) games, testing on the 255S Music,
The only sensor I've enabled is heartrate, but when I record a session I also see GPS and cadence data in the FIT file, despite not enabling it, and not setting the Positioning permission in manifest.xml. Further, after saving/discarding the activity and closing the app, I get rapid battery drain. This is fixed by rebooting the watch, so I'm assuming that the app or sensors are still active after calling System.exit().
function initialize() {
// Enable heartrate sensor
Sensor.setEnabledSensors([Sensor.SENSOR_HEARTRATE]);
// Define an activity recording session
session = ActivityRecording.createSession({ // set up recording session
:name=>"5 aside", // set session name
:sport=>ActivityRecording.SPORT_SOCCER, // set sport type
});
}
function onStartStop() {
if (activityStatus == STATUS_STOPPED) {
// Start the activity
session.start();
activityStatus = STATUS_FIRST_HALF;
WatchUi.requestUpdate();
if (Attention has :playTone) {
Attention.playTone(Attention.TONE_START);
}
}
else if (activityStatus == STATUS_FIRST_HALF) {
// Pause the activity
session.addLap();
session.stop();
activityStatus = STATUS_HALF_TIME;
WatchUi.requestUpdate();
if (Attention has :playTone) {
Attention.playTone(Attention.TONE_STOP);
}
}
else if (activityStatus == STATUS_HALF_TIME) {
// Resume the activity
session.start();
activityStatus = STATUS_SECOND_HALF;
WatchUi.requestUpdate();
if (Attention has :playTone) {
Attention.playTone(Attention.TONE_START);
}
}
else if (activityStatus == STATUS_SECOND_HALF) {
// Stop the activity, and present the save/discard menu
team1GoalField.setData(team1Score);
team2GoalField.setData(team2Score);
session.stop();
activityStatus = STATUS_STOPPED;
if (Attention has :playTone) {
Attention.playTone(Attention.TONE_STOP);
}
Ui.pushView(new Rez.Menus.MainMenu(), new FootballTrackerMenuDelegate(), Ui.SLIDE_UP);
}
return true;
}
function saveActivity() {
session.save();
WatchUi.pushView(new WatchUi.ProgressBar("Saving...", null), new FootballTrackerProgressDelegate(), WatchUi.SLIDE_DOWN);
var progressTimer = new Timer.Timer();
progressTimer.start(method(:finished), 3000, false);
return true;
}
function discardActivity() {
session.discard();
WatchUi.pushView(new WatchUi.ProgressBar("Discarding...", null), new FootballTrackerProgressDelegate(), WatchUi.SLIDE_DOWN);
var progressTimer = new Timer.Timer();
progressTimer.start(method(:finished), 3000, false);
return true;
}
function finished() {
System.exit();
}