Open torbenkeller opened 4 years ago
I investigated the problem a bit more and the function just works when the angle is min 25-30 degrees
Any updates?
Came here to submit this issue... just experienced it in the current version on Android. It await
s (with no timeout) until a new orientation is detected, it seems.
Same issue here on Android
A possible workaround for the time being
class CurrentNativeOrientation {
// there's a bug in the package when obtaining current orientation on android, so this is a workaround
NativeDeviceOrientation? value;
StreamSubscription<NativeDeviceOrientation>? _stream;
startListening() {
_stream = NativeDeviceOrientationCommunicator()
.onOrientationChanged(useSensor: true)
.asBroadcastStream()
.listen((event) {
value = event;
});
}
stopListening() async {
await _stream?.cancel();
}
}
It doesn't fail on me, but
var sensorOrientation = await c.orientation(useSensor: true)
is never resolved.
Getting the current orientation is a separate issue which will be resolved in 1.1.2, but I think this bug should be resolved so I'm closing it. Re-open if it isn't!
Getting the current orientation is a separate issue which will be resolved in 1.1.2, but I think this bug should be resolved so I'm closing it. Re-open if it isn't!
Still not resolved, as when flat, the package still returns a null value
@lore-co is this on android? I've (re)fixed the orientation retrieval for android in 1.1.3. The only caveat is that if the device is perfectly still, it won't necessarily return until it is moved (and I haven't figured out a way to get around that yet, unless I always have a sensor listener going which seems like a bad idea for battery life).
I used to have my smartphone flat on the table while debugging. When I not move the smartphone and want to call the method, the method just fails. It doesn't return and it doesn't throw an Exception. After moving the phone it works as expected, so I think the error is caused of not having a default orientation on init when the vertical and horizontal orientations are overlaying each other.