Et oui encore boussole... mais je lit les faqs, les réponse de forum, je ne trouve nul part mon probleme...
J'en suis a mon 4eme test de boussole et a chaque fois j'ai un décallade d'une 40 de degré en un Galaxy Tab et un S2, (j'ai egalement essayé avec d'autre tél galaxy il donne le même résultat que le S2) le probleme c'est que la tab a les bon Nord, et les autre tous pas bon...
J'ai téléchargé des boussoles sur play et là pas de probleme... Qu'est que j'oublie ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 /* get gravity value arrays from Accelerometer */ if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) gravity = event.values; /* get gravity value arrays from Magnet */ if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) geoMagnetic = event.values; if (gravity != null && geoMagnetic != null) { /* Rotation matrix and Inclination matrix */ float R[] = new float[9]; float I[] = new float[9]; /* * Compute the inclination matrix I as well as the rotation matrix R * transforming a vector from the device coordinate system to the * world's coordinate system R and I [Length 9] gravity vector * expressed in the device's coordinate [Length 3] geoMagnetic * vector expressed in the device's coordinate[Length 3] */ boolean success = SensorManager.getRotationMatrix(R, I, gravity, geoMagnetic); if (success) { /* Orientation has azimuth, pitch and roll */ float orientation[] = new float[3]; SensorManager.getOrientation(R, orientation); float azimut = (float) Math.toDegrees(orientation[0]);
Partager