Adobe AIR and iPhone - how it works? - iphone

Anyone knows how the Adobe AIR application are converted to iPhone apps? I see two ways - either the Adobe AIR virtual machine mus be part of every application or they must convert all ActionScript calls to Cocoa Touch calls somehow or have an Objective-C twin for every ActionScript class and then compile it to ARM assembler.
I am just curious how it is technically done.
BR
STeN

Unlike other platforms, Adobe Air is compiled into native code when you build an iOS application.
Here is a part of a blog post from Adobe:
We created a new compiler front end that allowed LLVM to understand ActionScript 3 and used its existing ARM back end to output native ARM assembly code. We call this Ahead of Time (AOT) compilation—in contrast to the way Adobe Flash Player and Adobe AIR function on the desktop using Just in Time (JIT) compilation. Since we are able to compile ActionScript to ARM ahead of time, the application gets all the performance benefits that the JIT would offer and the license compliance of not requiring a runtime in the final application.
That means that:
The Air runtime is not packaged within the application.
AS3 code is not converted into Objective-C code, but is compiled directly into native assembly code.

taken from adobe website: http://www.adobe.com/devnet/air/articles/air3-install-and-deployment-options.edu.html
Note that the captive runtime is the only option that is available when using AIR to target iOS. Since iOS does not support a shared runtime model, the captive model remains the only option on this platform.
Anyone using the captive runtime should be aware that it has two downsides:
Increased application size. Since an entire copy of the runtime is included in your application, the size of the application package is necessarily increased.
Increased security burden.

Related

Compiling an iPhone XCode project to work on Android

I have an iPhone app which is written in XCode and is currently selling on the iTunes app store. I want to be able to release it for the Android market. Is there any way to compile my app from XCode to work on the Android operating system. I don't really want to learn a new language and completely rewrite my app, so was wondering if there is an easier way.
There isn't any way to compile Android apps from Xcode, and i strongly doubt that Apple would introduce such a feature - if it's even technically possible to do. Sorry.
But if you have Objective C down, you shouldn't have to much problems understanding Java (which is used for creating Android apps).
Check the link below for a pretty comprehensive guide to start learning java and code for the Android platform:
http://mobile.tutsplus.com/tutorials/android/java-tutorial/
Good luck!
No, in general you can't do this. Even if assuming Objective-C can be compiled/converted into Java (which is most likely will not be true for times to come), you'll need to rewrite UI part; then most of OS APIs are different too. There are several features that iOS has that Android lacks or does not have open API for it, or has limited API, or has conceptually different or just different API.
Its just easier to move some of your iOS code into C/C++ shared library and then make sure that it compiles and works on both platforms. And then make platform dependent pieces separately for each platform (UI, hardware related stuff, etc.). This way you'll have at least part of your code shared.

What is the utilities of the airplay sdk as we have xcode?

Though we can develop the i-phone application in the X-code
Why we need to use the Airplay-sdk?
can anybody differentiate between them?
I use Airplay SDK (see www.immortalcode.com) and it works well. Their code has been evolving, but it is pretty solid now. The big advantage for me is to be able to keep my source code in C++, and to be able to use a single code base for multiple platforms. I have built multiplatform games (iPhone, Android, bada, Windows) all from Visual Studio on Windows. The main caveat with Airplay SDK is that you may not get access to all the functionality you would normally have on a given platform. In particular, you probably won't get the native UI look and feel, and you may not have important options like using the ad provider of your choice. My understanding is that they've recently made strides in opening up the full range of native APIs on iPhone and Android, but still I think there will likely be problems when it comes to certain highly platform dependent stuff. Again, working with certain ad providers comes to mind as the main example.
You don't need to use the AirPlay SDK. You can write an iPhone app without it.
Airplay is a cross platform development solution allowing you to write applications for iOS, Android and other smart phone and tablet devices.
It differs from Xcode in that Xcode is an Integrated Development Environment (IDE) with support for writing (mainly, but not only) Mac OS and iOS applications.
Airplay is a Software Development Kit (SDK). It is not in itself an IDE. You still need to use an IDE in order to write applications, and it appears that Airplay works with both Visual Studio on Windows and Xcode on Mac OS X.
It appears that Airplay uses C++ as it's main language, providing access to iOS APIs through a wrapper of some kind. It also appears to have its own UI library, meaning your app will look the same on all devices, but not the same as other apps written natively for each respective platform.
Airplay SDK is a C/C++ programming environment that supports multiple mobile platforms. It consists of several wrappers to native libraries for various mobile OSes and consoles ( Iphone, Android and Symbian amongst them ) and of a cross compiler ( gcc under the covers ) that integrates with Visual studio ( on Windows) and Xcode ( on Mac ). The wrappers provide an uniform programming interface among all supported operative systems. Basically you develop on your desktop and then you deploy on multiple platforms with a single click. The SDK is fair complete covering 3D and 2D graphics, a basic UI framework, sound and resource managment facilities for example. The main drawback is that multithread is not supported and that it may be problematic to use native features of a given OS. Also the GUI system doesn't provide out of the box the same elegance and look and feel one can found on the Iphone or Android. On Android, Iphone and Windows there is an extension mechaninms that allows one to link native libraries. I am using it to develop a 2d platform with Iphone and Android as the main targets. I found that the programming model proposed by Airplay suits a videogame very well but it may be inconvenient for GUI-heavy applications. However the framework is extremely solid and works well and I haven't found bugs so the code is well tested. If you are planning to develop a multi-platform game you should definitely give it a try. If you need to have more control on what happens under the covers and you would like to use native features I would also consider COCOS2D-X (http://www.cocos2d-x.org/) as an alternative.
The project is still immature and has a few bugs but I have tried it and I found it extremely promising. Moreover you have full source code: if you find a bug or need an extension you are free to provide your own solution.
Marmalade / AirPlay SDK will be providing access to native UI's in a forthcoming release. Check out their road map at http://www.madewithmarmalade.com/marmalade/releases-and-roadmap

Port AS3/Flex app to iPhone

I believe Adobe tools like CS5 have ways to output as an iPhone app, but what about a regular AS3 or Flex project? Are there any tools to auto-port, or AS3/Flex iPhone implementations out there?
Out of interest, how does the CS5 thing work? Is it a totally different code-path or something less drastic? For instance Flash supports Shapes and Timelines, etc... do they in fact provide an iPhone Flash runtime of some sort?
Packager for iPhone is what you should try out:
http://labs.adobe.com/technologies/packagerforiphone/
I guess its still a beta, but doesn't hurt in trying. It also has a standalone version (without the need of CS5).
Actually it is still the flash runtime, the same way that when you export a .exe in the publish settings (not an AIR native EXE, just a projector exe). It grabs the flash VM, and your source code, compiles your source and the flash vm wrapped up together into a single executable. It's just compiled down to ARM. There is still the flash runtime running inside that executable and your bytecode is still being executed against it. So virtualization is still essentially taking place. You're right in saying it's "native" assembly code but it's a far cry from a "native" application.
Regarding how it works, it is not a Flash runtime, but a way to compile ActionScript to native ARM assembly code, via LLVM.
Edit: also see Jesse Nicholson's answer.

support iphone,ipad,android

develop android apps that should support iphone,ipad,android.is there any way for developing this kind of generic app or we need to develop aps depending on mobile os
Though it is possible to create an universal application for iphone and ipad i don't think you can do the same for Android.
In my opinion it is always better to port your application to Android based on your requirements so that you can take advantages of the API's that the platform is offering you.
You can try using a framework named Titanium Appcelrator. This framework will help you target iPhone, iPad, Android with the same code base. This also lets you access most of the Native hardware features available with these platforms but not all. It seems that this also may support Blackberry soon.
We are struggling with the same question at the moment. Since we are working for Android, Maemo, Meego, iPhone and Blackberry (+Symbian 3 soon), HTML5 looked promising, and we dedicated quite some time investigating it. The end result was HTML5 is not yet ready for the development we were hoping for. It's fine if you need simple functionality, but as soon as something more advanced is needed, you need to create a different version. Even if it suits your needs, every platform requires different HTML5-to-native bridge, and every platform has a different engine. As you can see, only front end part could be partially used.
In your case, you need two different applications, one for Android, another one for iPhone/iPad. Try to see if you could take advantage of HTML5, if not, you are unfortunately stuck with separate development for some time to come. Unless you will create a web app and use it with device's browser.
You can create common functionality libraries with C or C++ and use these libraries in iPhone/iPad and use Android's NDK tool to integrate theses libraries with Android
On Android, you're using Java as the main language, and you can also use C and C++ . On iOS, you're using Objective-C as the main language, and also can use C and C++. So the common denominator would be C (at least on the iPhone there are no C++ GUI classes). I have no idea about developing on Android, but on iPhone it's no fun to purely work in C (and I'm not sure if it's even possible, maybe it is but should I when working with Objective-C/Cocoa is fun).
What you can do is write generic logic and share that between both systems, like a library. For example, I worked on a project where we used a C++ SIP/VoIP library that also compiles and runs on Symbian. It shouldn't be a big problem to write C code that can be shared between iOS and Android, as long as it is mostly about logic and not about calling system-specific stuff (you can of course include system specific stuff and guard that with #ifdef but you don't want your library to have more system-specific than system-agnostic code, I guess). For example, if you intend to write a networked game you could implement the network protocol in a way that could be shared between iOS and Android.
But as soon as you're hitting the GUI level I don't think you can share any code, and even if you could you probably don't want to because if you use the native languages/IDEs you are faster designing the GUIs each in their respective main languages/IDEs than trying to find a common way and then have to live with compromises and trying to make it work on both systems all day long. Better to implement the GUI native to each platform (e.g. Xcode has a very good graphical tool called Interface Builder that can save a lot of work/typing).
we can go for the XML VM to run the android apps in iphone.
Check this for more info.
xmlvm.org

Sharing Code between Flash Apps and iPhone Apps

I am interested in writing games for the iPhone and the Web. Ideally, there would be one language that I could write my games in and it would work on both platforms. I know this is not the case, so what is the best way to leverage code between iPhone apps (Objective-C/C++) and Flash SWFs (ActionScript)?
This maybe of some help
It uses the NME library which will allows code to mostly be written to the Flash 9 API and create the C++ for XCode to compile and run on the iPhone and Touch. This creates a path to port Flash games to iPhone/Touch.
Unfortunately, Flash and Objective-C are very, very different - and it's unlikely that a Flash player will be available for the iPhone in the near future. The native input methods used in Flash games - the keyboard and mouse - don't lend themselves well to the iPhone. While Apple could make Flash run on the iPhone, most Flash games would be totally unplayable (or feel very unnatural. They'd have to overlay a keyboard probably?). With the success of the App Store and native iPhone games, I think it's very unlikely you'll see Flash support anytime soon.
You might want to consider using a game development tool like Unity instead of Flash in the future. Unity allows you to create both 2D and 3D games, and you can program them in various .NET scripting languages. Once you've created the game, you can cross-compile it for web (their own plugin, not Flash), iPhone, or the desktop.
I know that doesn't help much since you have an existing codebase, but it might be something to consider for the future!
My company is developing a toolchain that allows compiling ActionScript3 to native code for mobile devices.
It now supports Windows Mobile and Symbian, and iPhone supported will be released in a couple of weeks.
Check it out at: http://developer.openplug.com/
BR
Guilhem
Adobe Alchemy looks promising. It is not released yet, but from their website:
Alchemy is a research project that allows users to compile C and C++ code that is targeted to run on the open source ActionScript Virtual Machine (AVM2).
This would allow iPhone apps and Web apps to share non OS-dependent C/C++ code, which is a very exciting prospect.
One option would be building everything in unity. The engine facilitates building the same game project to any of the following platforms:
Webplayer
OS X
Windows
iPhone
Wii
Actually, the iPhone supports Flash technically (see Developer creates Flash for iPhone and Flash Installer Update #2). It is just Apple's crippleware restrictions that prevent installation.
Other than that, there's really not much you can do. Flash/ActionScript and Objective-C are radically different. You can have a central server store data, but that doesn't solve the duplicated logic.
If you're already willing to use ActionScript you could go all the way over to the dark side and switch to Javascript. That's the only common language supported by your clients (web and iPhone).
How comfortable you are with either development environment certainly plays a role here. If you are a die-hard Objective C and a super star Actionscript programmer then doing both shouldn't be much of a problem. It will be lots of work of course, but not a problem.
However, if you are neither or only skilled at Actionscript then I suggest you focus on Flash/Actionscript for the time being. Eventually Flash will be available on the iPhone anyway. When that happens you can already have a number of apps ready to be quickly ported to iPhone. Also keep in mind. There are more portable devices out there than just iPhone. Getting your apps running on other devices might be worth it in the mean time.
Just keep in mind when you're developing your apps now that at one point you also want to run these apps on the iPhone. So make 'm in such a way that they can be controlled with an iPhone as well.
Updating this old QA with new information. The recently released monkey development framework deploys to both iOS and Flash: http://www.monkeycoder.co.nz/
It's so new that I wouldn't necessarily recommend it, but it has a great pedigree: the creator made Blitz3D and BlitzMax before, and those were great game development tools.
That said, I would strongly recommend a combo like Corona for iOS and Flash for web, so that you're using optimal tools for each platform.