{name: 'type', type: types_.ENUM, values: Object.keys(HumanActivityType)}
]);
- stopListener('HumanActivityMonitor_' + args.type,
- 'HumanActivityMonitorManager_stop',
- { type: args.type });
-
if (HumanActivityType.PEDOMETER === args.type) {
+ if (pedometerListener && !accumulativePedometerListener) {
+ stopListener('HumanActivityMonitor_PEDOMETER',
+ 'HumanActivityMonitorManager_stop',
+ { type: HumanActivityType.PEDOMETER });
+ }
pedometerListener = null;
+ } else {
+ stopListener('HumanActivityMonitor_' + args.type,
+ 'HumanActivityMonitorManager_stop',
+ { type: args.type });
}
if (HumanActivityType.GPS === args.type) {
};
HumanActivityMonitorManager.prototype.unsetAccumulativePedometerListener = function() {
- var oldPedometerListener = pedometerListener;
-
- // calling stop() will overwrite pedometerListener, needs to be restored afterwards
- this.stop(HumanActivityType.PEDOMETER);
-
+ if (accumulativePedometerListener && !pedometerListener) {
+ stopListener('HumanActivityMonitor_PEDOMETER',
+ 'HumanActivityMonitorManager_stop',
+ { type: HumanActivityType.PEDOMETER });
+ }
accumulativePedometerListener = null;
- pedometerListener = oldPedometerListener;
};