multi platform app development

Hi,

I’ve been developing few apps but I am not able to write the code that can work for all platforms (say ipad, iphone, galaxy tab,kindle,etc.). To do so, I have to make changes in my code for all different platforms. If at all I use same code, sometimes I have to change positions of the image or have to use image with different dimensions. What exactly can be done to accomplish this?

Thanks in advance… [import]uid: 71670 topic_id: 22964 reply_id: 322964[/import]

I had to use something like this:

http://developer.anscamobile.com/node/2766

Basically I placed items on different parts of the screen depending on if it was iPad or iPhone/iPod since the iPad screen is taller.

if(system.getInfo("model") == "iPad") then  
 item.x=100  
 item.y=20  
else  
 item.x=100  
 item.y=40  
end  

I would also take a look at this:
http://developer.anscamobile.com/code/device-metrics-scaling-based-screen-size

I have never used it before but looks very useful. [import]uid: 31262 topic_id: 22964 reply_id: 91719[/import]

Cross platform development has the illusion that you only have to write once and deliver to multiple areas with 100% of your code, but that’s not what it means. Its more like 80% of your code.

Instead of having to write in Java for Android and Objective C for iOS where 100% of your code is different, Corona lets you get 90+% of your code the same between the two.

Because devices have different hardware (screen sizes, shapes, cameras vs. no cameras, ability to make phone calls and not) you can never find a perfect formula to reach 100% compatibility.

Here are some examples… Want to use Inneractive Ads? You’re AppID is different depending on the device. The Kindle Fire has a status bar you can’t hide but counts against the content height.

Now you can for a lot of your graphical elements use your display.contentWidth and display.contentHeight to center and push design elements to relative positions on the screen. In other words you can anchor your menu button to the left side and your high scores to the right side without having to write device specific code and with the proper background sizes, and some cleaver setups in your config.lua file you can avoid huge amount of device tests.

Look through the blogs for Dynamic Resolution and there is a somewhat magical formula that helps with graphics. But the more precise location of where you have to place things, the harder it will be.
[import]uid: 19626 topic_id: 22964 reply_id: 91721[/import]

thanks aaron and rob for the reply.
can this be accomplished by doing necessary changes in config.lua like using zoomStretch, Or is it like I’ll have to use different background images for different platforms? [import]uid: 71670 topic_id: 22964 reply_id: 92168[/import]