Set Android screen orientation for Tablet vs Phone

710 views
Skip to first unread message

Randy Brown

unread,
Jan 24, 2015, 6:16:19 PM1/24/15
to phon...@googlegroups.com
I cannot for the life of me, find any documentation regarding how to specify a locked landscape screen orientation for Android tablets only, and keep Android phones in portrait mode.   This is very simple in iOS with the plist file.  Everything I find regarding Cordova has to do with setting the android:screenOrientation="landscape" in the AndroidManifest.xml file's <activity> element.  However, this locks both Tablet and Phone in landscape mode.

Not sure if i need to create specific layout directories or what...and if I did, would these even work with a Cordova build.   

Are there any links out there about how to accomplish this for Cordova built web apps?  Is it even possible?  

Ronald K

unread,
Jan 25, 2015, 6:09:38 AM1/25/15
to phon...@googlegroups.com
I worked around it by building two APK files. They have the same version number but different build numbers. And different combinations of screen sizes and orientation in the manifest. They'll show up as one app in the store, and G will serve the right APK.

Randy Brown

unread,
Jan 25, 2015, 7:58:23 AM1/25/15
to phon...@googlegroups.com
Interesting, thanks for the reply.  Do you have any links that describe your technique as being an acceptable practice?  That's the first I have heard that, but hey, if it works...I'm all for it!  Also, are you using the PhoneGap config.xml file or the androidmanifest.xml file to specify you different sizes?  Any way you could post the relevant sections of your manifest where you specify the different size information?

Thanks!

Ronald K

unread,
Jan 25, 2015, 1:00:15 PM1/25/15
to phon...@googlegroups.com
Here's the relevant page on Android.com: http://developer.android.com/google/play/publishing/multiple-apks.html

I defined the screen sizes in the manifest, and built the APK in Eclipse. I recall that building from the command line would override the versionCode. Not sure about that though, it was a while ago that I did this.
Reply all
Reply to author
Forward
0 new messages