I am currently doing the preliminary design for a new product my company will be pushing out soon. We will start on Android, but then we will need to quickly develop the IPhone, IPad…. and then the Windows 8 ports of the application.
Basically the only code that wouldn’t be reusable is the view specific code and the multimedia functions. This will be an SIP client (of course the user of the app will not know this) with several bells and whistles for our own business specific purposes.
My initial thought is to develop all of the engine in C and provide a nice API for the C library since JAVA and .NET will allow native invoking, and I should just be able to directly link to the C lib in objective-C.
Is there a better approach for vast code reuse which also remains close to the native platform? I.e. I don’t want dependencies such as Mono-droid and the like or complicated interpreter/translator schemes.
I don’t mind re-coding the view(s) for each platform, but I do not want to have multiple versions of the main engine. Also, if I want to have some good abstraction mechanisms (like I would in say, C++) is this possible? I have read that C++ is not allowed for the IPad and Iphone devices.
I would love to handle the media decoding in the C library, but I assume that this will be platform dependent so that probably will not be an option either. Any ideas here?
17
Since you are approaching for SIP client, and for the same PJSIP is providing a great library for using SIP feature at client end.
I have also implemented similar application, and for the same, I have create a C code which was handling all my objectives. And then as per iOS and Android platform for background tasks handling and for providing all the native UI implementation, I have done native app development in Objective-C and Java respectively.
Then in iOS, there is no problem for using C code, and for Android I have used JNI-integration.
I would look into Apache Cordova (was phonegap) which allows you a cross-platform HTML5/js based GUI. The interesting part to me was that all the code is packaged into the client rather than be run as a client/webserver model (though, obviously you can still talk to a network server for data).
I know a HTML5 gui isn’t going to be quite as snappy as a native one, but performance isn’t a major concern for most GUIs unless you have specific requirements like gaming.
For access to your crosss-platform C API, Cordova allows you to write a plugin to call the native code.
Adobe’s been doing work in cross-compiling ActionScript for different phone platforms. I’m Pretty sure Flash can compile down to Android and iOS now, as well as AIR (which might get you Windows Phone); I’m not sure how well this will work for SIP protocol-wise, but I’d think it’d support media pretty well. (But then I’ve not done any development in this area.) The Flash player has limited system access but I hear AIR’s support is a lot better, so you might be able to use some decent libs.
Edit:
AIR app for Android
AIR app for iOS