REVERSE_PORTRAIT is not detectable? - android

I am developing an App, and I want whenever the user change the orientation of the device I display the current orientation of the device. Actually, I achieved this step, but when i rotate the device to be in REVERSE_PORTRAIT the screen does not obey the rotation, in other words, my screen can not be in the REVERSE_PORTRAIT.
In the manifest file, I changed the value of android:ScreenOrientation to be user, but still in the same problem, all the three orientations PORTRAIT, LANDSCAPE and REVERSE_LANDSCAPE are detectable EXCEPT REVERSE_PORTRAIT
How can I find a solution for this problem?

You can try to use fullSensor if you want every possible orientation
"fullSensor" The orientation is determined by the device orientation sensor for any of the 4 orientations. This is similar to "sensor" except this allows any of the 4 possible screen orientations, regardless of what the device will normally do (for example, some devices won't normally use reverse portrait or reverse landscape, but this enables those). Added in API level 9.
all the possible values for screenOrientation and some explanations are here :
http://developer.android.com/guide/topics/manifest/activity-element.html

Related

Samsung Tab S2 not respecting manifest screenOrientation

I have an Activity that is meant to be displayed in landscape. Ideally I want to support either direction of landscape. In my manifest I've set this on my Activity:
android:screenOrientation="sensorLandscape"
Which has worked fine in all my experience in the past. But this device seems to decide sometimes that portrait orientation is allowed. It will rotate to all 4 orientations (landscape/reverseLandscape, and portrait/reversePortrait).
If I set it like this:
android:screenOrientation="landscape"
it works correctly. Also if I disable screen rotation then it works correctly. However both of these options leave me with no reverseLandscape.
I've also tried requesting the orientation to be set in Java code:
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
This does not seem to make any difference in the behavior.
Is this a known issue on Samsung devices? and is there any workaround to get the device to respect my sensorLandscape orientation setting?

Change NativeScript XML layout based on orientation

I have a question about NativeScript orientation (Landscape and Portrait).
Is it possible to check if the device orientation is landscape or portrait and based on that switch the XML layout file? For instance, use lay.land.xml for landscape and lay.port.xml for portrait.
Thank's for all...
NativeScript already does this out of the box. Name your files <file-name>[.<qualifier>]*.<extension>
land - orientation is in landscape mode
port - orientation is in portrait mode
Note: All qualifiers are taken into account when the page is loading. However, changing the device orientation will not trigger page reload and will not change the current page.
This is documented here: https://docs.nativescript.org/core-concepts/navigation#orientation-qualifiers

Android: Force different orientation for tablets programmatically

I want to force two different orientations in my app. Only portrait for smartphones and only landscape for tablets. Since I must define it in the manifest for each activity, I can't figure out how to it programmatically!
I tried with setRequestedOrientation(int requestedOrientation) in my activity onCreate but it doesn't really start with my requested orientation. There is some dalay before my request orientation is set.
Develop two different versions each forcing it's own orientation and targeting specific screen sizes and distribute.

AIR mobile always in landscape

I am making an app in AIR mobile that I need to be in landscape mode all the time. On most devices this is OK, but on some devices (Motorola XOOM for example) the app launches in landscape. At least on the build in emulator that comes with Flash Builder 4.5. I don't know if this is a problem with the emulator or if the XOOM has different orientations than most devices.
Anyway, I want to make sure that the device is always in landscape mode. This can be checked easily:
if(stage.stageWidth<stage.stageHeight){
//rotate screen;
}
What do I need to put in if statement to make sure that it is properly oriented?
Thanks.
In the *-app.xml file you can define how application should act:
<aspectRatio>landscape</aspectRatio>
<autoOrients>true</autoOrients>
Even with aspectRatio set to landscape and autoOrients set to false in application.xml, sometimes a device's orientation is incorrectly set during the first frame of a mobile air 3.1 app, so stage.stageWidth will return the smaller of the two dimensions. Several frames later it will flip to the correct orientation. This could be what you witnessed.
So if you need to know the landscape stage dimensions when your app first loads, use:
var width :Number = Math.max(stage.stageWidth, stage.stageHeight);
var height :Number = Math.min(stage.stageWidth, stage.stageHeight);
You should not need to rotate your entire app manually, but here's how:
this.rotationX = 90
You should take care in locking rotation in your app, if you ever submit to the Apple store you can be denied if the app won't adjust to the device being held upside down. Many devices differ in what their 'default' orientation is, but setting your app descriptor with a starting aspect ratio of landscape should work. In AIR 3.3 there is a change so that setting stage.aspectRatio will keep the expected aspect ratio, regardless of the device's default orientation, or the device being upside down.
You need to set:
<aspectRatio>landscape</aspectRatio>
<autoOrients>true</autoOrients>
in your app descriptor. You also need to set
-swf-version=16
in your compiler options. With these setting and AIR 3.3, the app will hold a landscape aspect ratio, regardless if the device is rotated to the 'top' of the device is on the left or the right. Setting the aspect ratio to portrait will make the device keep portrait aspect ration, even if the device is held upside down.

froyo's universal rotation and my landscape only app

My app is set in landscape only mode thanks to an attribute in my manifest file, but with froyo came universal rotation and a problem. It will force the screen to landscape but if the user is holding the phone upside down my app will appear upside down. Is there a way for me to set my app to only rotate when the user has their phone orientented in both landscape positions?
I have one app in landscape mode and put in manifest this attribute:
android:screenOrientation="landscape"
Put this into activity and works fine for me (Froyo 2.2 Nexus One)
... By the way sorry for my english

Categories

Resources