Shared codebase for iOS and Android [closed] - android

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to develop an App for iOS and Android. For easier maintenance I want to have a shared codebase where the business layer and all the algorithms are implemented.
But I don't want to program the whole application in for example Xamarin. I would like to develop the presentation layer in Xcode and Eclipse and use a framework which has implemented the business layer, algorithms and so on.
It is very important for me that the presentation layer is programmed in the corresponding development environment (Xcode, Eclipse) and the shared codebase is implemented as a framework/dynamic library.
I tried Xamarin (Mono) and Qt for iOS but it seems like there is only the way to develop the whole application in this development environments.
To sum up what i wanna do:
/--> iOS App --> implements framework --> .app
shared codebase* --> framework --<
\--> Android App --> implements framework --> .apk
* e.g. Java / ObjectiveC / C# / C++ / Xamarian / Qt or whatever
Do you know any development environment or a trick how to do this whith Xamarian?
I googled a lot and didn't found anything which helped me solving this problem. I also know that here on stackoverflow are some questions covering this topic but they didn't completely answer my question.
Thank you a lot for your answers!

Xamarin allows you to create business logic in C# and use them for both Android / iOS / Windows Phone. You have to write your view logic also in C#. Xamarin has ported the API for both iOS and Android to C#. You can still use the designer tools from xCode (I guess for Android as well) and use them in your project. But it's true you'll have to use Visual Studio or Mono Develop to create your app.
So you either use the xamarin solution or you'll have to create a cross-platform library in C/C++. For iOS you can indeed just add C++ code. For Android you'll have to use the NDK. You'll have to use JNI (Java Native Interface) to be able to let the Java and C++ code talk to each other.
NDK: https://developer.android.com/tools/sdk/ndk/index.html
JNI Tutorial: https://code.google.com/p/awesomeguy/wiki/JNITutorial

Related

Difference between Xamrin android, Xamrin iOS and Xamrine crossplatform project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What is the difference between xamarin android, xamarin ios and xamrin crossplatform project? xamarin android and xamrin ios are native? I thought we only make one single app on Xamarin that works on both ios and android.
p.s: just started to work with Xamarin.
I will copy the info from here
Xamarin Android makes it possible for you to create native Android applications using the same UI controls as you would in Java, but with the flexibility and elegance of a modern language (C#).
Xamarin.iOS allows developers to create native iOS applications using the same UI controls that are available in Objective-C and Xcode, except with the flexibility and elegance of a modern language (C#).
And Xamarin Cross Platform, it's a little more complex to explain.
As you can see in the image, with Xamarin Cross Platform, you can share a tremendous amount of code between your apps(iOS, Android, UWP, etc) and if you use Xamarin Forms you can share the UI (which is based in XAML and of course you can implement native things with Custom Renders).
You can view more about Xamarin in their developer web page:
https://developer.xamarin.com/guides/
Another thing to notice is when you use Xamarin.iOS or Xamarin.Droid you are dealing with the lifecycle and the UIs of iOS or Android. That means you need to have the knowledge of both platforms. If you are using Xamarin.Forms you will have another, more common, lifecycle and a common UI. So you don't have to know the platform specifics. (except you need a more complex app).
When i think of Xamarin.Forms i always ask myself "what have ios and android in common?" The answer would be for example "a label, a switch a listview etc." this things you will find as Controls in Xamarin.Forms. Things like SegmentedControl from iOS you will not find there, you have to write a CustomRenderer to use them!
To be clear, with Xamarin.Forms you can also use 100 percent of the platform specific API. For Rendering stuff you need a CustomRenderer as mentioned before and for platform specific things like the calendar you have to use the built in Xamarin DependencyService to handle both platforms in the common code.
No matter which way you choose all three ways result in a native app
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/dependency-service/introduction/
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/

QML on android - will C++ work for business logic? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Doing some investigation on the feasibility of using QT/QML for an upcoming project. Client wants it initially on Windows and Mac desktops, with the possibility of iOS and Android down the road. They would like to know that what we build will move relatively easily. I'm not much of a desktop programmer, but what I see is that QML is designed to work with C++. As a result, it should be relatively easy to build an app that runs on Mac and Windows, and iOS will accept C++, so I can't see a lot of roadblocks there. But I'm confused about Android. I see folks talking about building an Android app using QML, but they seem to still be using java; I gather it uses the NDK in the background.
But if you write an application that has QML for the front and, and C++ for any guts not covered by QML, can it work on Android? Or do you need to rewrite the C++ piece in java? The app is not a simple one, so we are going to have to provide some logic outside of QML, at least, it sure looks that way. While we might save time and $$$ by using QT to not have to go native on the desktops and iOS, I see a problem with Android down the road.
But if you write an application that has QML for the front and, and C++ for any guts not covered by QML, can it work on Android? Or do you need to rewrite the C++ piece in java?
It really depends. You may need to go through the Java interface where the Android platform does not provide direct and public API for certain functionality. One example is low-level IO operations, like writing the serial port for usb-serial devices, but there is more to it.
In general, what Qt modules and third-party software based on Qt do is to use the QAndroidExtras add-on module introduced in Qt 5.2. This will allow easy backend integration into your C++ logic.
With that in mind, you could hide the Java implementation details in the background while you still maintain the C++ interface to QML. Therefore, it should just work that way.
Please see the following documentation to get the grasp of it:
Qt Android Extras
Here you can find one of those nice examples:
Qt Notifier - Demonstrates calling Java code from an Android application.

Common code base for developing an app for different smartphone OS's [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm new to iOS/Android development so I would like to know what is the usual practice of developing an app for different platforms - is the whole code rewritten or the possibilities are used to choose some language, C or C++ for example, and keep most of the work in this language and then cover it with system specific stuff in corresponding language? I know about Android NDK and having C/C++ code in your iOS app, but the question is - is this usually used in practice - maybe later some other platforms might be added? The classical example would be the Angry Birds, of course, which I have even on my "smart" TV. Would be good to hear guys experienced in this area since I might be in the middle of making a decision. Thanks!
You should go check out the Xamarin studio. It allows you to write code in C# and reuse up to 80% of your code between the platforms. They have some videos and tutorials for how to best write code that can be reused.
You might try Qt framework as it's native to Symbian, officially ported to Android, and unofficially ported to iOS and Blackberry. It's a C++ IDE at http://qt.nokia.com
Better yet, if you're into that kinda thing, try PhoneGap here: http://phonegap.com/ This will allow you to write your "app" code in HTML.... yes, HTML, and port it to just about anything. Things that are normally OS-dependent are basically wrapped in PhoneGap's API including hardware: http://phonegap.com/about/feature/
THe classical example would be angry birds? I've either hit a time warp to 20 years in the future, or you're thinking way too small.
But yes, it is quite common to write the majority of logic in C or C++ and just write system specific stuff and/or UI in the native language.
There are several cross-platform solutions on the market. Some of them use Java and C#, they usually are integrated with the common SDKs (such as Visual Studio, Eclipse). Some of them allow to easily develop and distribute web-apps using HTML5, Css3 and jQuery combination.
You can just surf for them on the net. I suppose it's not allowed to mention them here. If I'm wrong I will post the name of some of the most known solutions that I tried.

iOS and Android c socket programming + GUI [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I'm going to develop an application for iPhone (iOS) and Android. It should run as a unix daemon gathering data and send it using a TCP/IP socket.
We already have a c socket util written in Windows. My thought is to OS cross compile for BSD and Linux and then use it on iOS and Android.
Ive looked a bit at "Android NDK" and guess it should work on Android.
Would that be possible on iPhone iOS or can it only be done in Objective-C?
In case of a GUI layer "on top" of the daemon - would it make sense to reuse the c socket util and the use Objective-C and Java for iOS and Android respectively - with some kind of communication between.
Finally, I prefer c++ - is that possible on iOS also?
First of all, Android code is written in Java so you are just making your life hard by writing your daemon in C. If you look in Android Fundamentals you will see that it is straightforward to have a part of your application that runs as a service.
IOS is even more restrictive than Android because it does not support Java at all. However you might be able to do what you need using XMLVM to compile Java for the iPhone. If your server is not very complex it would probably be easier to just rewrite it in Objective C.
You can call C/C++ code directly from Objective-C code on iOS. It's even easier to integrate C/C++ code on iOS than on Android, where you need a very syntax specific JNI layer between Java and C++.
I would say that C/C++ is MORE native on iOS than on Android. C/C++ files can be added directly to the XCode project, and will be compiled with CLANG.
I am adding this as an answer because I believe the other answer to be mostly wrong, including the comments underneath it.

Porting iOS app to Android [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
we made a quit big iOS application with 2000+ objective c classes. I am wondering there is a best practice guide to port it to Android ? Currently I am looking at Visual Paradigm (UML) which reverse engineers objective c files to UML. Like Enterprise Architect it also allows me to generate code(headers + declaration) for another popular language like java or c++. Are there any other approaches yet ? Also, as our app is heavily using the UINavigation and UIView controllers, I am wondering there is similar model and implementation on Android.
Thanks so far, guenter
In all honesty, I think that what you are planing is just going to make for crappy code that will be insanely hard to maintain. I realize it sounds like a lot of work, but its gonna be easier in the long run, I would just "port" the concept of the app to android and write it from the ground up.
The Apportable SDK
It cross-compiles Objective-C applications to Android, without extensive changes to the original codebase. Instead of translating the code to Java, Apportable cross-compiles your code to run directly on the Android device’s processor, bypassing the Java runtime, resulting in speed and performance that rivals the iOS version.
The platform has been tested on Apportable’s library of over 150 devices and in the wild, where Apportable-powered apps have received 5-star reviews on thousands of devices.
check out the sdk here
AFAIK there is no automatic tool to convert Objective-C to Java. There is java2objc that does the reverse.
Here are some official tips for porting Objective-C to Java: http://www.nextcomputers.org/NeXTfiles/Software/WebObjects/Guides/PortingObjectiveCtoJava.pdf
I'm not an iOS expert, but AFAIK iOS does not have layout managers - it uses XIB/NIB to do layout (or dynamically in code, which is not recommended). On Android there are layout classes which are primarily used to support different resolutions. Also, layout is declared via XML files.
So it seems there is a lot of hand-coding in front of you. Since a project is quite large, I'd get a help of an expert that knows both Android and iPhone.
For going from C or C++ to Android you are probably best of using the NDK. The problem is that I don't think this is possible (at least, not directly?) for Objective C.
I think it might be best to try and go to C, and then use the NDK to make it into an app for Android. Going from your code, trough UML to JAVA sounds like a much harder option.
just to let you know how the story did end up, I kept using Sparx Enterprise Architect and have my design, architecture and documentation well under control, for all platforms finally except for JavaScript. Its a bit tedious when integrating new features but in an enterprise environment it saved me a lot of time. We are working on iOS, Desktop(Web2.0/HTML5), Android, Blackberry, Symbian and some router systems. To get rid of platform specific things, I introduced always an additional layer. Seems to work for our products so far.
Thanks to all again, g.
MyAppConverter service helps to convert native iOS mobile apps instantly to native Android app, it's not focused mainly on the look and feel, and UI interaction of your app. That means it don't replicate your application as it is. Instead, MyAppConverter make all changes to make a project suitable for the development of an Android application.
MyAppConverter currently support only iOS to Android conversion and objective-c to swift.

Categories

Resources