I have a project requirement to create a kiosk based application which will always be in the landscape mode,for which I am making use of a tablet running on 4.2.2.One of the modules has the functionality to make phone calls.For making the calls from my app, I invoke the default android dialer app.However,I notice that even if my device is physically in the landscape mode,at times when the default dialer app is called,it first displays its portrait layout and the quickly switches to the landscape one(which is not visually appealing).Now,since I do not have access to modify the source code of the default dialer app,I was wondering if there is a way that I can specify a system level screen orientation as landscape ?
PS: I have root access for my tablet.
Any help would be appreciated.Many thanks !
There's an app for that: Rotation Locker
You can also add the switch ro.sf.hwrotation 90 in your build.prop file
Related
I can already lock the android application in landscape mode from the manifest file of android. But we use a custom tablet built solely for our company and due to the manufacturing defect, the laptop orientation is reversed.
Is there any way I can lock the application in reverse landscape mode??
You can use react-native-orientation-locker which allows us to lock the orientation of device in our desired way using the following methods,
lockToPortrait()
lockToLandscape()
lockToLandscapeLeft() this will lock to camera left home button right
lockToLandscapeRight() this will lock to camera right home button left
Let say I have an application designed to open other applications just like a apps screen on android phones. I wanted to keep the device in landscape. At the same time, if other applications designed to be working in a portrait mode, I wanted to show as Portrait in a landscape screen rather than stretch the application to fit within the landscape screen.
This is the screenshot as an example:
The red shape is the application running in portrait.
The black shape is the screen of the device in landscape.
At the moment, my application will load the portrait app in full screen mode which the red shape will be fill the whole screen.
P.S. The device I am using can be rooted.
My launcher at the moment can load the application and cause the application to rotate into portrait on a Portrait screen.
Spending days of finding. The solution is to root the device and calling wm size 300x800 or any number as a su privilege in code.
The way to root the emulator to test can be found in here:
https://android.stackexchange.com/questions/148841/attempt-to-root-avd-running-android-4-4-5-1-is-failing
Use the appropriate API Level as stated in the answer. Otherwise it may not work.
The way to call the su command :
https://github.com/neoimale/android-screen-mock/blob/master/ScreenMock/src/com/dianping/screenmock/MainActivity.java
I have developed an application that runs images and videos (with a default application to display them) for a certain time period.
However I want to run all these images and videos only in a landscape view. I want to lock this, irrespective of rotation settings. If possible, I would also like make it to only portrait view in future. Please advise.
It is not possible to change device orientation programmatically, you can redirect user to those setting but not possible to change from app side. e.g you can redirect user to GPS setting screen but not set it from app. Same concept apply for rotation as well.
My app has to support landscape/portrait mode only for tablets, phones will only support portrait mode. What is the best way to implement this?
Options that I am considering:
a) using two apk files, one for phones and one for tablets. The one for phone will lock landscape mode in the manifest
2) using one apk file. Detect that device is a phone, lock landscape mode inside each activity.
any advice will be appreciated.
Regards
You can use a SuperClass for activities and implement this https://stackoverflow.com/a/9629127/710162 on, for example, onCreate().
I have written a dock app that utilizes the stock dialer within android but it always displays in portrait mode is there a snippet that I must include to get the dialer to respond to being in the dock. How do I call the layout that the stock dock program does?
Thanks in advance.
You can tell the user to put it in a dock, I suppose. If the device is in landscape mode, and the application does not support landscape mode (e.g., the dialer on my Nexus S), that is just the way it is.
More generally, you have no right to dictate how third party applications should look and behave, any more than other people have the right to dictate how your application should look and behave. The application will look and behave how its developers designed. If they have different layouts for landscape or being in some sort of dock, they will use those layouts... when they are in landscape or in some sort of dock.