I am writing an application which uses the Sensor.TYPE_LINEAR_ACCELERATION.
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
This was working up until recently however each SensorEvent now returns a values float array containing: NaN, NaN, NaN.
I have tried the same code on an LG watch and it is returning values as I would expect.
The versions of software on the SWR50 are:
Android Wear 1.1.1.1929530
Google Play services 7.5.71 (1955121-534)
Android OS 5.1.1
Note that the Sensor.TYPE_ACCELEROMETER returns values (which was confirmed in the Manufacturer (Menu-Launcher) app in the developer options) so the accelerometer doesn't appear to be broken.
Can anyone from Sony confirm this issue? Otherwise maybe I need to get a new watch if it is broken.
Sounds strange that it would just stop working all of a sudden.
So it looks like the Sensor.TYPE_GRAVITY is the issue. It returns valid results after a reboot and then the next time I run the app it returns NaNs. Presumably LINEAR_ACCELERATION is using the gravity vector to calculate this.
If I had to guess I would say some spurious value is being put into the low pass filter that is calculating the gravity vector and once that happens it will never recover.
I guess if it is a random value that is being added then occasionally it might be valid which is why occasionally it seems to work.
I guess the work-around is to read the Sensor.TYPE_ACCELEROMETER values instead and do the low pass filtering to work out gravity.
I upgraded my Sony smart-watch-3 SWR50 firmware to following and my application is no more getting callbacks from Sensor.TYPE_LINEAR_ACCELERATION.
Android Wear 1.4.0.2715035
Google Play services 8.7.02 (2624717-534)
Android OS 6.0.1
Build Number: MEC24H