locking the Iphone screen with phone Gap - android

I wanted to know if the phone gap allows you to lock the screen to one position and not change it's resolution when the user is turning his iphone/android device?
I'm Developing an app that is based on HTML/JS and don't want to build my UI Again when the user is turning his phone from side to side
Just To make Clear - I'm working inside the device browser with HTML/JS/Jquery
is it possible?
p.s my intention is presenting the app in portarit position

On manifest file, where you have the activities list, on activity node you should add:
<activity android:screenOrientation="portrait" ...../>
or
<activity android:screenOrientation="landscape" ...../>
depends on what you need.

You can set the orientation for your app in xcode for iPhone:
or in your android manifest file with:
<activity android:screenOrientation="portrait" .../>
or
<activity android:screenOrientation="landscape" .../>

Related

Stop App Screen Rotate to the Side

My app stops from working for some reason when the phone is rotated to the side and so the app does too. How can I avoid this, making it so it appears only vertically? Thanks a lot
add this to your activities in android manifest :)
android:screenOrientation = "portrait">
Here is a full example:
<activity
android:name=".Activity.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
</activity>
In your app's manifest file, set activity to be vertical... Its easy...

How does one catch the onsize event (or equal) for android

I'm attempting to react to a size change in my app. Or more specifically I'm trying to figure out when the keyboard shows up.
I've tried #Override ... onSizeChanged() of the main windows (a RelativeLayout view extension)
It gets called when I change the orientation, but not when I show/hide the keyboard.
My layout is not scrolling, so the controls at the top of my screen fall out of view, and the only way to get them back is to hide the keyboard.
I've read a pile of other sites and googled the snot out of this one, but it has me befuddled.
Oh.. I'm on a 2.1 (aka 7) build of android, and I'd like to be able to run the app on my own phone :)
Oh.. so the question. How do I catch something resembling onSize on an android device.
Try to add below to related activity in manifest.xml
android:windowSoftInputMode="adjustPan"
For Example
<activity android:name=".SignUp"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" >
<intent-filter>
<action android:name="android.intent.action.ACTIVITY" />
</intent-filter>
</activity>

Orientation Changes distorted the View in Android device

My app is done in Titanium. I am struggling with a issue which is that when I= launch the App by keeping the device in landscape mode. Then while loading Splash screen it first goest in Landscape mode and when app finally launches Whole UI got distorted by that orientation change. I have added the below line of code in TiApp.xml
<application android:screenOrientation="portrait" android:configChanges="keyboardHidden"/>
even though its rotating. I want to stop the orientation change of that splash screen while launching. Any idea?
In each activity you have to write
<activity android:name=".MainActivity" android:configChanges="keyboardHidden|orientation" android:screenOrientation="landscape" />
Hope it help!!
Try this. Add you custom androidManifest.xml For custom xml
and add this line in androidManifest.xml and run I think this is very useful for you.
<activity android:configChanges="keyboardHidden" android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
<activity android:configChanges="keyboardHidden" android:name="ti.modules.titanium.ui.TiTabActivity" android:screenOrientation="portrait"/>
Cheers

How can we set in application run only vertically not horizontally? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
I want my android application to be only run in portrait mode?
I want to set the database for run only vertically not in horizontally so what changes in application ?
You can specify in your activity in manifest.xml how you want it to work
e.g
<activity
android:screenOrientation="landscape"> //for landscape ie horizontal
and
<activity
android:screenOrientation="portrait"> //for portrait ie vertical
If you want to make your application in force portrait mode you can to do by adding this in the manifest file :
<activity android:name=".activityName" android:screenOrientation="portrait" />
Your question is too vague.
To use your application only vertically (portrait) mode, then following changes you have to do in manifest file
<activity android:name=".YourActivity" android:screenOrientation="portrait">
This will allow your activity to run in vertical mode (portrait mode) only and its activity configuration will not be changed even if you change device orientation.
You do this in the AndroidManifest.xml file on the activity. Take a look at the Activity element documentation.
<activity android:name=".MyCustomActivity"
android:screenOrientation="portrait"
[...]
Programmatically you can do this in your activity as follows:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);

Forcing 'portrait' orientation not working - any tips?

Hey all - I have tried to only display my app in portrait view orientation to no avail.
I have the code: android:screenOrientation="portrait" in every button, ImageView, TextView, etc... in my xml files but when I tilt the phone to the side, it still goes into landscape view.
I do call the camera in my app, but I don't think that is the issue - any thoughts?
the layout is the wrong place. you have to place it in the activity like this:
<activity android:screenOrientation="portrait" ...>
Force an Android activity to always use landscape mode
is google that hard to understand? google "android force portrait" and the first four links shows the answer... (sorry.. just had to let it out :) )
You have to put the android:screenOrientation="portrait" in the AndroidManifest.xml.
In AndroidManifest.xml you have to do something like this:
<activity android:name=".Your_Activity_Name"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"/>

Categories

Resources