How do I emulate changing the orientation of my android device? - eclipse

I'm working in Eclipse using the Android SDK and Android ADT plugin, and I have some functionality based on phone orientation that I want to test in the emulator (more specifially, I want to verify my solution to this problem).
How do I emulate the orientation change?

If you mean,switching during runtime,than:
.Switch to previous layout orientation (for example, portrait, landscape): KEYPAD_7, Ctrl-F11
.Switch to next layout orientation (for example, portrait, landscape): KEYPAD_9, Ctrl-F12
Is that what you need?

Related

Aframe mobile can't detect orientation of the device

I'm working on a project with A-Frame. My problem is that when I open from my iPhone (model Xs Max) even the easiest example code moving the device will not change the camera rotation. But when i go to https://aframe.glitch.me/ this one works even if it is the same code. The device motion and orientation is enabled in iPhone settings. What am I missing?

unity PC build settings screen resolution doesn't work?

i'm trying to run with my own resolution so I inserted the resolution in the build settings. However, when I build it and run, there is no screen resolution option for the one I inserted. I want to build with screen by 9:16(common mobile resolution) but there are only ones like 10:9 or 16:9.
I search on Google and they told me to go to 'Edit'->'Player'->'Player Settings' but there is no 'Player' in mine.
Can anyone tell me how to set up resolution?
9:16 and 16:9 aspect ratios are the same so you should be fine by using 16:9 and changing the screen orientation.
You can read more on the screen orientation here and you can set it in Player Settings if you build for mobile platforms. [Edit -> Project Settings -> Player is the right path.]
Screen orientation is platform specific and only appears when you build for mobile platforms (Android, IOS...). You can set it as you like or you can use AutoRotation value as well - in that case the device will determine how to display your game.

Unity app with different screen orientations

I'm developing a game that runs on both mobile phones and tablets.
Currently I'm using only the Portrait orientation for all devices but the portrait orientation looks better on phones meanwhile landscape orientation looks better on tablets.
I set "Portrait" option in the Unity's Player Settings > Resolution and Presentation > Default Orientation but I would like to provide a landscape layout for tablets (without affecting phones).
How I can I do that? Is there any why to programmatically set the Screen orientation when the application starts?
You can try Screen.Orientation
In the Start (or Awake) method of a MonoBehaviour that is added to the stage call:
Screen.Orientation = ScreenOrientation.LandscapeRight
Now you just need to check if the device is tablet or phone, I don't know any way out of the box to do this, but you can check the aspect ratio and base your decision on this.
You can check the aspect ratio by getting Screen.width and Screen.height.

iPhone mobile Safari vs home screen link resize issue

I am trying to write a web app for Android and iPhone.
I have an issue when the device orientation changes. On the Android the orientationChanged event fires (from portrait to landscape) before the new horizontal dimensions are reported (reports portrait dimensions, with iPhone it fires AFTER (reports landscape dimensions...correct behavior).
So I fell back to the resize event. Another issue cropped up. Android works fine in browser. iPhone is works fine when the app is launched from the home screen. However in mobile safari, the resize event is never triggered when roating from landscape to portrait, since the browser just provides you the capability to scroll around the page horizontally.
I need a way to detect an orientation change event and get the new dimensions from DOM elements in order to resize other elements on the screen that will work for Android, mobile Safari and home screen web apps.
Thanks
Fell back to device detection, since there is no reliable way of doing this generically.

Landscape mode not working with no keyboard in AVD?

I've created two AVDs, one with hardware keyboard, and other without..the one with keyboard shows the landscape mode in the android screen when I click CTRL + F11/F12 or 7/9 on numpad, but in the AVD with no hardware keyboard, the hardware things all change orientation, like the first AVD, but the android screen stays and doesn't change orientation to landscape, like this: http://img571.imageshack.us/img571/3624/landscapeh.jpg
This is a bug in the 2.3 AVD and it is already answered here
Android - Emulator in landscape mode, screen does not rotate
Run 'Android SDK and AVD Manager'
Select AVD
Edit
check Keyboard lid support
if value is no, set to yes.
Run AVD and try
Good luck!!
I had the same problem with an API 19 (Android 4.4.2). I had wanted to only support running in Landscape mode. Despite setting Orientation to Portrait when editing the device (under Startup size and orientation), the device would always start Portrait.
I ended up manually switching the width and height in the hardware-qemui.ini file.
So, edit this file in a text editor:
C:\Users\<user>\.android\avd\<deviceName>.avd\hardware-qemu.ini
Switch the values of the width and height, so that the width is longer than the height:
hw.lcd.width = 800
hw.lcd.height = 480
The AVD now boots in Landscape mode. The orientation may still be changed with shortcut keys.