Samsung Tab S2 not respecting manifest screenOrientation - android

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?

Related

Issue when trying to fix orientation screen to natural or default orientation

I would like to lock the screen orientation specifying the configuration in the AndroidManifest, instead of doing it programmatically. So I've ended up with the following approach:
values/config.xml
<resources>
<integer name="orientation">1</integer>
</resources>
values-sw600dp/config.xml
<resources>
<integer name="orientation">0</integer>
</resources>
If I check the value’s resource programmatically
getResources().getInteger(R.integer.orientation)
I get the expected value: 0 for tablets and 1 for handsets, which is the value specified by the framework for landscape and portrait orientation respectively.
But if I use this resource in the AndroidManifest:
<activity
android:name="activities.InitialConfigActivity_"
android:noHistory="true"
android:screenOrientation="#integer/orientation" />
The activity always launches in portrait mode, regardless if it is a tablet or a handset device.
Any thoughts?
Thanks!
Edit: I originally read your question to mean you wanted complete control over the start-up orientation. If you are satisfied to get the natural/default orientation, then use nosensor as described below.
This may not qualify as an answer--I had more to share than could be put in a comment.
You've probably already looked at the discussion in these related issues: related-1, related-2, related-3.
In my experience, when an issue has been investigated by a number of different people for a period of four years, with no solution found, it usually means there is no solution.
One option might be to use the nosensor orientation in your manifest:
android:screenOrientation="nosensor"
This starts the activity in the device's "default" or "natural" orientation. On my devices this is: phone=portrait, 7-inch-tablet=portrait, 10-inch-tablet=landscape. Won't work for you if you want landscape for 7-inch tablet.
This post includes code for determining what a device's default orientation is.

REVERSE_PORTRAIT is not detectable?

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

Tablet devices loading wrong orientation

My app only uses one page which is the main activity and in the manifest it is set not to allow rotation hence the orientation stays the same wether or not you rotate the device. however on tablets when a user is in landscape orientation and runs the app. the app loads the default orientation (Portrait) but in a landscape view instead and im seeing only half the screen.
help.
This is part of my activity in manifest i use nosensor to disable rotation.
<activity
android:name="com.paul.xicon.MainActivity"
android:windowSoftInputMode="adjustPan"
android:label="#string/app_name"
android:screenOrientation="nosensor">
I'm not sure how are you disabling the screen rotation. But this should work just fine in your activity tag of manifest.
android:screenOrientation="landscape" (disables the screen-rotation & restricts to landscape mode)
or,
android:screenOrientation="portrait" (disables the screen-rotation & restricts to portrait mode)

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.

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