NathanaelA / nativescript-orientation

A NativeScript plugin to deal with Declarative UI and Screen Orientation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The sensors option in getOrientation is not implemented

Tronix117 opened this issue · comments

I needed a solution to guess the device rotation, while the app is locked in Portrait. I saw the method getOrientation(true), and the doc says it will infer the orientation from sensors on Android. Otherwise it doesn't seem this mecanism is implemented.

Don't know if you plan to do it one days (could be great to have Android+iOS), but this issue is a reminder.

The (true) method is already implemented, that is why it is documented. Are you sure you aren't getting the valid rotation returned even while locked.

Nop, always gettint portrait, no matter what I do.

Also, it seems the options is not used there: https://github.com/NathanaelA/nativescript-orientation/blob/master/src/orientation.js#L57

I couldn't find this logic in the code ?

Ah, you are right -- I forgot; I removed that code a while back, I had a version that had it at some point but found that the new logic that I came up with in v2 was better. So that flag was removed, looks like I need to update the docs...

Any solution when orientation is locked ? How to find out which way the device was ? Usualy it's done using sensors, so having this possibility is still a great enhancement, don't you think ?

So if the screen is locked to port; but you physically rotate the device to landscape; you want the sensor value of landscape, correct?

Actualy I want to know the hardware rotation, not the software one.

For exemple when your device is locked with android:screenOrientation="portrait"

@NathanaelA
In my case I disable the rotation. In IOS the application.orientationChangedEvent event still fires with correct physical value. BUT in android the event does not trigger...
Is there any way to detect orientation change even if the screen is locked on android?