Hello,
I’ve written a little smartwatch watchface (with the Ketai Libary), and the compass value isn’t changing. I tried it with getting the Sensor manually, but then it said me, The field Sensor.TYPE_ORIENTATION is deprecated.
.
So i searched and found this (Android Developers) .
There stands the new thing for accessing the orientation is this (SensorManager.getOrientation()
)
But it expects parameters, from where should I get them?
OS: Windows 10
Mobile: Galaxy S7 edge Android 9
Watch: Fossil Sport
Code (Ketai Libary)
void setup() {
fullScreen();
//size(390, 390);
frameRate(60);
smooth(2);
sensor = new KetaiSensor(this);
}
void draw() {
background(0);
displayCompass();
}
void displayCompass() {
stroke(204, 0, 0);
noFill();
strokeWeight(width*0.08);
strokeCap(SQUARE);
ellipseMode(CENTER);
println(compass);
arc(0, 0, (width-width*0.56), (width-width*0.56), radians(-5 + compass), radians(5 + compass), OPEN);
}
void onOrientationEvent(float x, float y, float z, long time, int accuracy) {
compass = x;
}
Thanks.