I've already worked around the problem; I wasn't posting here looking for 
solutions, more to put this out there so that the next dev getting 
motion-sensor errors on a Note 3 (or similar) would be able to find it. 
Sorry I didn't make that clear.

My solution looks like this:

try {
SensorManager.getRotationMatrixFromVector(R, rotationVector);
} catch (IllegalArgumentException e) {
if (rotationVector.length > 3) {
// Note 3 bug
 float[] newVector = new float[] {
  rotationVector[0],
  rotationVector[1],
  rotationVector[2]
 };
 SensorManager.getRotationMatrixFromVector(R, newVector); 
}
}

I couldn't come up with a good decision criteria for trapping the bug 
preemptively, so I went with catching the exception instead. I've confirmed 
that this solution works with a Note 3 user who was experiencing the bug, 
plus it doesn't break on other devices (including a Galaxy Nexus on 4.3 and 
a Galaxy S4 on 4.2.2).

String

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to