D daemon Active Member Licensed User Longtime User Aug 25, 2014 #1 I observe duplicate calls to Sensor_SensorChanged when PhoneSensor is used in a service and StartListening() / StopListening() are called multiple times. It looks like StopListening() doesn't actually stop listening to sensor events and every call to StartListening() adds another callback, resulting in duplicate events. Attached code demonstrates the behavior. Actual output (log window) is: Event count (Start): 0 Event count (Stop): 10 Diff: 10 Event count (Start): 24 Event count (Stop): 44 Diff: 20 Event count (Start): 82 Event count (Stop): 112 Diff: 30 Event count (Start): 163 Event count (Stop): 203 Diff: 40 Expected output: Event count (Start): 0 Event count (Stop): 10 Diff: 10 Event count (Start): 10 Event count (Stop): 20 Diff: 10 Event count (Start): 20 Event count (Stop): 30 Diff: 10 Event count (Start): 30 Event count (Stop): 40 Diff: 10 Attachments SensorService.zip SensorService.zip 8.1 KB · Views: 698
I observe duplicate calls to Sensor_SensorChanged when PhoneSensor is used in a service and StartListening() / StopListening() are called multiple times. It looks like StopListening() doesn't actually stop listening to sensor events and every call to StartListening() adds another callback, resulting in duplicate events. Attached code demonstrates the behavior. Actual output (log window) is: Event count (Start): 0 Event count (Stop): 10 Diff: 10 Event count (Start): 24 Event count (Stop): 44 Diff: 20 Event count (Start): 82 Event count (Stop): 112 Diff: 30 Event count (Start): 163 Event count (Stop): 203 Diff: 40 Expected output: Event count (Start): 0 Event count (Stop): 10 Diff: 10 Event count (Start): 10 Event count (Stop): 20 Diff: 10 Event count (Start): 20 Event count (Stop): 30 Diff: 10 Event count (Start): 30 Event count (Stop): 40 Diff: 10
Erel B4X founder Staff member Licensed User Longtime User Aug 25, 2014 #2 I see it too. Please download the attached Phone library (v2.26) and copy it to the internal libraries folder. It should fix this issue. Attachments Phone.zip Phone.zip 78.2 KB · Views: 781
I see it too. Please download the attached Phone library (v2.26) and copy it to the internal libraries folder. It should fix this issue.