1

Is it Reccommended to use JNI and C++ Code to make a shared library code between IOS and Android ? I'am asking this because i think it not just saves us plenty of wasted time for implementing same logic in both platforms but also we will have the speed of a C++ core Backing the logic-process of our modules.

Update :

I ask my question in another way :

is it recommended to share a C++ Library for core functions of Android And IOS versions of a similar app ? or it would be better to completely migrate the codes to a multiplatform language ?

AmiNadimi
  • 5,129
  • 3
  • 39
  • 55
  • JNI seems irrelevant for iOS, since you typically don't develop iOS apps in Java. Instead, you'd probably interface with the C++ code using Objective-C++. On Android you'd need to use JNI (or something similar like JNA), unless you're making an entirely native app. – Michael Jul 27 '16 at 11:53
  • I know , but it is possible to create a c++ library and Share it in both codes. – AmiNadimi Jul 27 '16 at 13:09
  • And also these posts show that JNI is not really irrelevant to IOS: [post1](http://stackoverflow.com/questions/18334547/how-to-use-the-same-c-code-for-android-and-ios) , [post2](http://stackoverflow.com/questions/30132490/native-jni-on-ios) – AmiNadimi Jul 27 '16 at 13:12
  • Of course it's possible. I'm not sure what the question really is though. JNI (or JNA) isn't just recommended for interfacing between the Java and C++ code of an Android app - it's necessary. – Michael Jul 27 '16 at 13:12
  • we have an app that needs to run in both IOS and android but we don't have enough time to write down all core libraries in both swift and java language (UI is Something else , no argues on that) . so we eighter choose cross-platform techs like Xamarin or we have to use JNI based core. If you Know any other possibilities , i would be glad to know . (except that we are not going to use things like ionic that would be Web based ) – AmiNadimi Jul 27 '16 at 13:20
  • The first question you linked to doesn't involve using JNI on iOS. It involves using JNI on Android and Objective-C++ on iOS to interface against a common C++ code base. I'm not sure what to make of the second question, since I don't see any mention of what toolchain/framework he's using. Typically you wouldn't develop an iOS app in Java though, so JNI would be irrelevant. – Michael Jul 27 '16 at 13:20

1 Answers1

0

Since I remember my needs back then, I know that hybrid apps were not an option, Also JNI is not used for making cross-platform apps but the best use is to drive hardware peripherals via native UNIX scripts for Android or run c++ code on Android. So if we omit PhoneGap, Appcelerator, Ionic etc we will be facing several cross-platform technologies that have attracted many developer attentions so far.

Xamarin:

The framework was founded by the same people who have created Mono, an Ecma standard-compliant, .NET Framework-compatible set of tools. Xamarin offers developers a single C# codebase that can be used to produce native apps for all major mobile operating systems.

Unlike many other frameworks, Xamarin has already been used by over 1.4 million developers from around the world. Thanks to Xamarin for Visual Studio, developers can take advantage of the power of Microsoft Visual Studio and all its advanced features, including code completion, IntelliSense, and debugging of apps on a simulator or a device. Xamarin Test Cloud makes it possible to instantly test apps on 2,000 real devices in the cloud. This is by far the best way how to deal with the heavy fragmentation of the Android ecosystem and released bug-free apps that work without any major issues. But being honest I didn't enjoy my first time face-to-face meeting with Xamarin. There were so many bugs and also speed and performance problems were bothering.

React Native

React Native is developed by Facebook and used by Instagram, Airbnb, Walmart, Tesla, Baidu, and many other Fortune 500 companies. It is an open-source version of Facebook’s React JavaScript framework. Because React Native uses the same UI building blocks as regular iOS and Android apps, it’s impossible to distinguish a React Native app from an app built using Objective-C or Java. As soon as you update the source code, you can see the changes instantly manifest in an app preview window. Should you ever feel the urge to manually optimize certain parts of your application, React Native lets you combine native code with components written in Objective-C, Java, or Swift.

The ones I mentioned above are not the only options, but since now they are the most used frameworks between programmers. But beware that Flutter is being publicly announced by Google in Google IO and maybe it may be going to create a hit soon.

AmiNadimi
  • 5,129
  • 3
  • 39
  • 55