![](https://csdnimg.cn/release/download_crawler_static/9930808/bg12.jpg)
11CHAPTER 1: The Android Market: A Background
Porting Difficulties
For those who want to turn their iOS app into a full-fledged Android application (or vice versa),
we want to let you know the process and pitfalls. If you’re only focusing on the Android market, you
can safely skip this section. However, many developers aim to develop for both Android and iOS in
order to maximize their revenue. We will cover how to do that by the end of this chapter.
Let’s say you’ve written an iOS app that is out right now or perhaps waiting in the app approval
process. To turn it into an Android application, you have to adapt your software so that an
executable program can be created for a computing environment that is different from the one that it
was originally designed for. This is known as porting.
iOS apps are generally written in Objective-C, while Android apps are generally written in Java. Although
the logic of these programming languages is quite similar because they are both linear, procedural, and
use notions of object orientation (OO), they are very different with respect to OS support, GUI objects,
and application life cycle. Sadly, Objective-C is not supported on Android.
As far as we know, there isn’t any magical program that will allow you to put iPhone apps in and
get Android applications out (unless you use development tools that have this in mind from the
beginning). We will talk about cross-platform development tools later, but first we’ll explain what you
can do for both Android and iOS.
Although your iOS coding can’t be reused for Android coding, you don’t have to rewrite all your
Android code from scratch. For example, you can completely reuse the icons and images, as well
as any SQLite database code. Additionally, certain types of C code in an iPhone app (for example,
code for image processing or digital signal processing) may be directly utilized in Android using the
Android Native Development Kit (NDK). Although you might think that the user interface (UI) design
would be reusable, iOS and Android have different UI elements, and forcing an Android app to
behave like an iPhone app can be a time-consuming (and costly) endeavor. In some situations, you
may be able to reuse use cases that were written for iOS apps, but you should consider the impact
that the Android UI has on your use cases. Also, the Android ecosystem tends to favor free apps
with advertising or in-app purchasing more than iOS does. In other words, a change to the overall
business plan might be in order when porting to Android.
It usually takes nearly the same amount of effort to port an iOS app to Android as it does to create
it. It really depends on how big the application is, as well as the complexity of the code, reliance on
GUI tools, and ability of the developer.
By the way, there are people who make it their business to program apps, and that could lighten
your workload. Since your app already exists in one form, it’s easy to outsource application porting;
the developer can always use the original app as a reference.
If you have written your iOS app in ANSI C or C++, perhaps using one of the many gaming engines
that are designed for that purpose, then your task may be simplified. Android has the NDK, which
allows for ANSI C or C++ code to be called from the Android Java code and vice versa.
Examples of Cross-Platform Development Tools
Chances are you want your application to be downloaded as much as possible, which means you
probably want it to be on as many devices as possible. If you want to have your application on both
iOS and Android as well as other mobile platforms, you may want to use one of the cross-platform
development kits.