Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

The sensors option in getOrientation is not implemented #27

Open
Tronix117 opened this issue May 21, 2018 · 7 comments
Open

The sensors option in getOrientation is not implemented #27

Tronix117 opened this issue May 21, 2018 · 7 comments

Comments

@Tronix117
Copy link

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.

@NathanaelA
Copy link
Owner

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.

@Tronix117
Copy link
Author

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 ?

@NathanaelA
Copy link
Owner

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...

@Tronix117
Copy link
Author

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 ?

@NathanaelA
Copy link
Owner

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

@Tronix117
Copy link
Author

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

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

@anki247
Copy link

anki247 commented Aug 27, 2018

@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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants