Different Layouts Per Device

Hey all, so I’ve been reading through many tutorials and forum posts, but just can’t seem to get it completely.  What I am wanting to do is create a universal build of my app for iOS.  However, on the iPad the layout will be landscape, and on the iPhone/iPod it will be portrait (and use different images and scaling than the iPad).  I think I can understand that part, but now let’s throw Android into the mix.  On Android I would like to do the same thing, however I can’t find a reliable method to detect an Android tablet vs phone.  Can anyone shed some light on this?  Also, am I better off maintaining two different project folders for this (i.e. one for iOS, one for Android)?

Hi JonPM,

This tutorial might not solve everything you need to do, but it’s a good start in how to detect various devices and adjust the code:

http://www.coronalabs.com/blog/2012/12/11/device-detection-on-steroids/

Brent

Thanks Brent, I had come across that article and it is definitely a big help.  Do you think it would be best to maintain 2 project codebases? One for iOS and Android (then possibly a 3rd just for Amazon)?  In my case dynamic scaling is only half the battle. 

I think you’re going to find that trying to support a landscape iPad app and a portrait iPhone app is going to be a struggle if you want to maintain a single build.settings file.  Apple lets you have separate iPad and iPhone builds or Universal where one app works in both places.   You probably can use one source with a bunch of “if” statements to manage your UI, but you will probably need two different build.settings files and build for a specific device with a specific build.settings file.

As for Android the same trick might work, but it’s going to be a lot harder determining if you’re on a tablet or phone.

Hi JonPM,

This tutorial might not solve everything you need to do, but it’s a good start in how to detect various devices and adjust the code:

http://www.coronalabs.com/blog/2012/12/11/device-detection-on-steroids/

Brent

Thanks Brent, I had come across that article and it is definitely a big help.  Do you think it would be best to maintain 2 project codebases? One for iOS and Android (then possibly a 3rd just for Amazon)?  In my case dynamic scaling is only half the battle. 

I think you’re going to find that trying to support a landscape iPad app and a portrait iPhone app is going to be a struggle if you want to maintain a single build.settings file.  Apple lets you have separate iPad and iPhone builds or Universal where one app works in both places.   You probably can use one source with a bunch of “if” statements to manage your UI, but you will probably need two different build.settings files and build for a specific device with a specific build.settings file.

As for Android the same trick might work, but it’s going to be a lot harder determining if you’re on a tablet or phone.