My work consists of porting an iPad application to Android (so from Objective-C to Java). I've developed in the Android environment, but never in iOS. Currently I am looking for advice -- I'd like to know if is there a way, method, or process which can help me to do this more easily.
At this stage generally the answer is no, but I've got some suggestions that might help.
Use UIWebView/Webkit extensively - baring any HTML5 media (and SVG), there's little porting required when you render HTML. What you render in one, generally, renders well on the other.
If your iOS app is a basic show-this-edit-that style of app, you may find PhoneGap, jQuery Mobile, Titanium or the new Adobe suite a better time investment.
Because Android lacks a consistent device base, which makes developing animation-rich UIs difficult, you might find that there is no 1-1 UI comparison. Instead think about the features you offer, and their underlying data and view models.
You should be able to create a similar UIViewController/Activities structure although the tying logic behind the scenes will be platform specific. Map this out on some paper - it makes a really good what-the-hell-do-i-do-next plan for your UI skeleton.
Prefer an intermediate abstraction between your 'in data' and 'out data' so you can exchange parsers/kits/apis/frameworks without hacking everything to bits.
Where you have custom draw routines and graphics, ensure that you've got filler gradients or colours. Android uses a box model to support the many many screen sizes - iOS only has 4 resolutions to worry about. Recreating the same look might take too much time - contrasting pastel colours are a good placeholder until you can justify making the artwork.
There's not a lot more that can say that hasn't already been said before.
Hope this helps!
Few advices:
You will in most cases need to do redesign of UI as iPad, being tablet PC and having a larger screen as compared with most Android devices. Advice: Check if there is a version of the application dedicated for iPhone as it could be very helpful during redesign stage.
Check if iPad code contains beside Objective-C code also C/C++ code. If there is significant amount of code you might consider using Android NDK which allows C/C++ code to be used together with Java.
If the iPad application was using one of the popular cross platform frameworks (e.g. PhoneGap) that are based on HTML5/CSS/JavaScript combination you might be able to reuse most of the code. Both iPad and Android browser/ui elements responsible for rendering HTML5 are based on same engine (WebKit) and generally generate similar experience. Note: Some frameworks allow custom access to native functionalities which will require rewrite in almost all cases.
Do not try to create exact same UI on Android if it conflicts with user interface guidelines. As you probably know the guidelines are available at: http://developer.android.com/guide/practices/ui_guidelines/index.html
Android users are used to certain interface and they should be getting similar experience as other apps available for Android. Also it might be more than painful to create similar controls for Android that exist on iPad. If there is pressure to make same "look and feel" here is a post that explains how to defend from such pressures: Porting iPhone applications to Android? How to convince them NOT to
Numerous features existing on iPad will not be available on Android (e.g. Android application splash screen using just an image). So analyse the iPad application and decompose it to set of functionalities. Once you have them then you can map them to Android API and start coding.
There are no Objective-C to Java converters at the moment (this might change in the future) but for general feeling what are differences between Objective-C and Java you might want to read "Porting Objective-C to Java" by Theresa Ray of Tensor Information Systems Inc
Related
Sorry if the title wording is not clear enough. I need to deploy a very simple app on Android and iOS for a partner company (app does not need to be in App Store or Google Play) to control some machinery via bluetooth. Interface needs to be very basic and only contain a couple of buttons and some text labels that display some information (and be able to read a QR code).
We are not a mobile development company, thus I don't have any experience building apps like this, but the required functionality seems simple enough to at least look into what needs to be done.
Now, the problem is that I only know C/C++ and Python (moderate experience with the Qt framework) and am not really willing to learn both Java and Swift. I might consider learning Swift specifically for a simple project like this, seeing as iOS development is very much tied to their platform, but Java is out of the question. I've looked around and there seems to be a way to write both of them in Python and deploy to each platform, but something tells me it's not really worth the incredible amount of problems that could arise. I need your help with some advice on how to handle this project:
Can a cross-platform app be developed with python(or C/C++) and deployed to iOS and Android (thus halving the overall development time) whilst keeping a sufficiently tidy aspect and bluetooth communication?
If not, can I develop an Android app using C/C++ or Python without immense hurdles? I'd prefer Qt as i'm already familiar with the framework, but i suppose anything does it.
When developing an Android app under point 2, is it possible to see how the app looks like without installing it on the phone for every change in code?
Sorry if the post is too long, am really curios how difficult would a task like this be. I dont want to waste my time learning 2 new languages for just this project nor do i want to end up delaying the partner company with beginner problems caused by my scarce knowledge of a new language.
I really wouldn't suggest cross platform for this kind of project. The bluetooth stacks and APIs are going to be tremendously different, minimizing ability to code share. The UI stacks are completely different. Really using anything but the native tools on iOS can be particularly tricky. Python in particular is hard, because its not meant to interact with either platform. C would be easier, as both Java (via JNI) and Swift (via objective C to C bridges) can call C code. However the UI layers of the two are so different that it would only be useful for business logic, I would still recommend writing the UI in the native platforms.
If you were going to try and do cross platform, I'd suggest react native and javascript, merely because it's the most mature of the cross platform products. That said, their bluetooth stack is likely non-existant or poorly developed because its not the type of thing used by many of the type of apps that choose react native, so you'll likely have to dive into the deep end and learn how to make modules.
Given that this is going to be a company specific app not on an app store- do you actually need to support both OSes? Or can it be done on company devices of a single type? Pushing back on that product requirement might be your best bet.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am the only mobile developer in my job. Before I was hired, my currently boss was thinking on using Xamarin as their marketing says the words Shared code and native.
I consider myself an advanced Android developer since I've build large information systems. Right now I'm working on simple apps I could finish in a week, but Xamarin is giving me headache since its too buggy, and the reusable code is about 10% that could easily be copy/pasted into iOS, and despite the fact that you can share that 10% code, sometimes you still have to use compilation directives #if / #endif.
I mean, there is no really any advantage for me, since I already know both Java and Objective-C languages. I already have vast knowledge of SQLite and data storage with Core Dataon both iOS and Android SDK so that learning Xamarin will make it slower.
I have already tried to talk them into not going for Xamarin since its only a little code you can share, but they don't seem either to understand.
I need some good argument to convince them not to buy it, so I can do my job in a more productive and faster way. Thank you in advance.
Some good points from Lee Whitney's Blog: Why I Don’t Recommend Xamarin for Mobile Development:
App Overhead
Xamarin based apps have a built in overhead that makes them larger on
average. This affects download time and storage used on a device.
The minimum additional size is usually a few megabytes and can grow
proportionately as the code uses more of the APIs. This is due to the
way code from .NET assemblies is statically linked (as native code)
into apps as the assemblies are referenced. On Android there is also
an extra startup delay for apps for OS specific reasons. To
Xamarin’s credit this overhead used to be much greater and the company
has made great strides in reducing it. However, the impact on app
users is still measureable.
Limited Sharing of UI Code Across iOS and Android
User Interface development is not portable between iOS and Android.
This means APIs, event logic, widgets, and designers must be used and
coded differently for each platform. There are a few exceptions to
this for common, low level operations.
Xamarin would argue that trying to abstract UI APIs across very
different platforms can create unnecessary complexity or lead to a
poor user experience with an LCD (lowest common denominator) design.
They have a point here. Titanium tries to do this partially, and the
result has made many developers unhappy with the inconsistent or
unpredictable results. HTML5 apps are more successful at pulling off
this UI abstraction without forcing an LCD design, but they do not
have the native performance of Xamarin.
UI problems can be some of the most time consuming aspects of
developing mobile apps. Despite having a good justification, the
important takeaway is that for many mobile UI problems, Xamarin will
not save developers or designers time.
Limited Sharing of Code Outside of Xamarin
Xamarin does not allow creation of reusable components or modules
outside of it’s own environment. For example, code written in Xamarin
cannot be used in native or HTML5 apps. This means any code developed
by a team using Xamarin cannot be shared or reused with teams using
any other tooling for iOS and Android. How much this matters depends
on the situation, but the problem with development is we can’t predict
all of our situations. So it’s an uncomfortable limitation to have
right out of the gate.
Ecosystem and Community
This is something that is not really Xamarin’s fault. What company
has a mobile ecosystem that matches Apple, Google, or HTML5? However,
it matters. When developers are 10 times more likely to find results
when searching the web about an issue, it directly impacts
productivity. The ecosystem of available support, services, and 3rd
party components, and related tooling is, and will continue to be,
significantly smaller than for native or HTML5 based apps.
The Third Learning Curve
Some concepts and techniques require special knowledge specific to the
Xamarin environment. This effectively adds a third learning curve for
developers beyond programming language and native APIs. For example,
developers having to understand iOS reference counting to avoid
problems with Xamarin’s garbage collection
(Is this a bug in MonoTouch GC?).
Another example is data structures and generics working in subtly
different ways
(http://docs.xamarin.com/guides/ios/advanced_topics/limitations).
These are the types of issues that are hard to see before you actually
adopt a new platform, so they merit special consideration.
More Moving Parts
Xamarin introduces it’s own set of bugs that affect product quality
and developer productivity. The problem is not that Xamarin has a
bad product, but that adding any large or complex system to the app
toolchain comes with problems and bugs that do not exist in native
apps.
The historical record of these bugs can be reviewed using Xamarin’s
bug tracker (https://bugzilla.xamarin.com).
Yes, all software has bugs. The point is when you measure the
advantage of adding new tools; the disadvantage of new problems must
be factored in.
Summary
In the end we have to try and quantify the benefits of a development
abstraction like Xamarin over other abstractions, or over native
development. Is C# better than Objective-C? Yes, by far in my
opinion, but that’s only one factor. When you add everything up it
tips the scales away from Xamarin in favor of other approaches to
mobile development. As of 2013 (this stuff can change quickly) I tend
to choose a native code solution or an HTML5/Cordova solution. I like
both for different reasons and will try to explain some of the
decision factors in another article.
I am thinking of developing a program within ASP.NET. But that I could port easily to Apple, Android and Windows phones and tablets. I also want the program to be able to run on PCs (MAC´s?).
This seems to be fine. However, the normal GUI of Windows does not look at all like the GUI from e.g. iOS or Android. And this would be a big show stopper. It should be at least optimized for touch mode. So all on screen widgets should be a bit bigger.
Are there libraries, providing controls, which looks like normal ones on the operating system? It would be best if this works kind of automatically. So the program should find out where it runs and load the standard GUI best fitting to the device, where it is being started.
I could of course develop own controls, but this may be a bit too much of effort.
It would also be very nice if the library would handle different screens or modes like portrait and landscape. So that it may switch depending on the orientation of the tablet, or phone for instance.
I am searching for something like that, which provides a good result, without the programmer needing too much to do by himself.
I also like if one can recommend a library he is using already by a bigger program. From my own experience, you get to know the strengh and weakness of such libraries with the time passing by.
Best Regards.
I already discovered some tools like PhoneGap, Sencha, Mono. I do not know, if these are well suited for me.
I like to create an app most likely for all plattforms at the same time. Is this the case with e.g. PhoneGap?
I am not familar with JavaScript, or CSS or HTML development.
I am an experienced C# programmer and I am quite familar with Java. So VisualStudio is my daily working environment, and I am using Eclipse also a lot.
Mono:
I only read about it and found out this aspects:
cost 999$ to use it in Visual Studio. Hope that this price includes development for all plattforms and not just one. Did not yet check this.
The coding looks very good.
There are APIs for Android, iOS, and Windows Phone to setup controls. So these parts needs to be rewritten for any supported application. One may create a core library, which can be used for all components. This aspect is not so nice.
However, I would prefer a solution, where the GUI is even described on another level. And then it should be brought to the current plattform automatically, if not specific libraries are used. So HTML5 may be more flexible.
Best Regards,
Patrick
I created an Android app. While creating one specific app was an interesting challenge, I'm now looking into creating a group of similar apps.
I'd like to create a group of similar Android apps and then move on to creating the same on tablets and iOS... (anything mobile).
I've considered doing so with a product called PhoneGap or doing a web based mobile app. Both of these options seem less than ideal. Doing the Android app I've been frustrated by Java's lack of control and low level constructs. Moving to something like a web based app seems like the exact wrong direction.
C++ is my language of choice. It has the ability to work at a low level, is highly portable across platforms, and has significant support for generic coding which would be useful for generating a group of similar apps. However, the Android documentation suggests to not use C++ unless your goal is porting existing code or dealing with computationally heavy tasks.
I'm leaning towards using C++ anyway, but are there other options I've not considered?
Thanks
You could in theory write your logic in C++ and then have UI layers on top that make use of it. If you are really comfortable with C++ that might be the way to go.
Almost any other parts (networking, UI, animation, etc) are better off being done in the native language of the platform. Use of cross platform solutions always limits you in some way, and usually leads to an application that is not as good as it could be for any platform.
Well, Google's recommendation to not use C++ is based on the following, I believe. C++ is low level, so you can get extra performance out of it if you know what you are doing. Google makes the reasonable assumption that many programmers do not. It is easier for an inexperienced programmer to do harm in C++ then to get a performance boost.
But, if you know what you are doing, it can help you. UI elements on both iOS and Android are implemented in their main language (obj-c, and Java respectively) so there is not a great way around that, but you can write core logic and other functions in C++ and it will be portable between them (iOS can use C++ directly and Android can use it via the Native Development Kit).
There are a few other options available. The one I ended up using is Appcelerator Titanium but please stay away from it. If your project gets complicated or large at all you will hate yourself for choosing it, as I did. Another interesting one that uses C++ instead of Javascript is Marmalade. I haven't used it though, so I can't comment on it.
A non-free solution that I hear good things about is Xamarin, who have ported both environments to C# and a .NET using Mono. However, you still have to write two versions of your code for the UI as far as I can tell.
As the topic states - is there any technology that would let me write code for a simple commercial 2D game which could be then compiled to work well on Android, iOS and Web browsers or at least two of them (e.g. Android and iOS)? There is so much buzz about cross-platform nowadays that I was wondering if I'm missing something.
My goal (set by my producer) is to make this game for all of these three platforms, and so far I planned to use:
- Web browsers: Adobe Flex,
- Android phones: Java (since my favourite C++ is recommended only for short snippets),
- iPad/iPhone/iPod: Objective-C (are there any alternatives?).
It pretty much means re-writing the same source code three times. Is there any way to speed it up by using a technology that would work on at least both of them?
However, I don't want to use Adobe Flex for all three (though it's possible), because it requires Adobe AIR (works only with Android 2.2 and higher) and not a lot of phones have it (it's totally different with browsers where 98% of people have Flash).
I don't mind adding some platform-specific code for each version, of course.
Also, if you have any suggestions about choosing a fancier technology for any of the platforms (maybe some nice frameworks?), I'd really appreciate that, too.
Take a look at Corona and Moai both are Lua-based frameworks for game development targeting multiple platforms.
I would like to say that Multimedia Fusion was capable of doing this, but it isn't quite ready yet. There are currently a number of runtime exporters for the product which allow you to export your game to multiple target platforms which include flash, java and iOS at the moment. XNA and Android exporters are currently in the works. I should probably mention that I am only affiliated with these guys as a happy consumer of their products. It is probably worth checking it out even if they can't do everything you want yet. If it's not suitable for your needs it is still a very good choice if you wish to rapidly prototype your application.
See:
http://www.clickteam.com
On a side note, personally I would recommend against going down the js+html5 route, particularly if you are targeting mobiles. I should probably stress that it's simply an opinion I have and that there are plenty of people here who will disagree with me. In all javascript games I have played, I have felt the garbage collector. The issue is that without control over garbage collection it is free to run when it feels like, causing infrequent but very obvious pauses in the middle of your game. You can work around this but I don't see why it should be that difficult. I can definitely align with the ideals of being able to write the thing once and run it on all platforms, but I can't see it working just yet.
To offer some advice assuming you find no suitable tools for the job, your aim is to maximise reusability. This means all of your games resources and levels should be well defined as independent resources. For non-critical logic you can make use of embeddable scripting languages such as Lua, which will maximise your code reuse. C (or C++) code will also be reusable on a lot of platforms, and might be a good choice if you are familiar and confident with the language.
I'm personally using Phonegap and Zepto.js. But you may have more luck with jQuery mobile. Phonegap is nice because its website will compile the apps for you.
1) If you write your game in C++ you can use it for iPhone & Android (NDK) as well. Preferably, you write your game engine in C++, than you can use a OS specific layer for UI stuff..
2) Implement your game in HTML & Javascript. iPhone/Android users will have to use a webbrowser to play your game. For iPhone, you can even create a launcher, that looks like an app, but actually is a webview with HTML & Javascript
Unity3D should be able to do this for you, if you purchase some extra sprite addins to handle 2D (like Ex2D or SM2 or Toolkit 2D). Also right now until Apr 8, the iOS and Android license is free.
Game Maker Studio. It has a package that let's you deploy on all of the platforms you outlined.
http://www.yoyogames.com/gamemaker/studio