The service provided by Consileon was professional and comprehensive with a very good understanding of our needs and constrains.

Wolfgang Hafenmayer, Managing partner, LGT Venture Philanthropy

Technical quality of staff offered, capability of performing various project roles, as well as motivation and dedication to the project (... [...]

dr Walter Benzing, Head of development B2O, net mobile AG

Technical quality of staff offered, capability of performing roles of developers, lead developers, trainers, team leaders, architects as wel [...]

Karl Lohmann, Itellium Systems & Services GmbH

Firma Consileon Polska jest niezawodnym i godnym zaufania partnerem w biznesie, realizującym usługi z należytą starannością (...)

Waldemar Ściesiek, Dyrektor zarządzający IT, Polski Bank

The team was always highly motivated and professional in every aspect to perform on critical needs of our startup environment.

Denis Benic, Founder of Ink Labs

Cross-platform mobile apps with single codebase

Category: Frontend

Photo by Jonas Lee (https://unsplash.com/photos/4K9AoksCS7U)

In Europe, about 70% of people are using smartphones with Android, and approximately 26% is loyal to Apple and its iOS devices. When your product has to reach both platforms, the cost of development increases significantly. There is a need for hiring a team that can write software for Android (Java/Kotlin) and iOS (Swift/Objective-C) in parallel. For startups or small companies with a limited budget, such approach is quite often unreachable. That means decision-makers have to resign from one of the platforms or postpone development in time. In such situation, it is worth to take into consideration hybrid applications which allow having just one code base for multiple platforms (iOS, Android, and evaporating Windows Phone). The final cost of the project may drastically decrease, and your app can appear in all stores. Hybrid solutions are not adequate for all use cases, but still, there are situations in which such approach works very well.

How do mobile hybrid apps work?
The hybrid mobile application looks the same as a native one. The main difference is hybrids are just web applications embedded into a mobile browser component. For building such app developers are using web technologies like HTML, CSS or JS. Access to native functionalities (like camera, microphone, GPS localization, contact list or push notifications) is possible by using JavaScript API. The final app without any troubles can be placed in app stores.

When using hybrid applications is a bad idea
The main problem with the hybrid approach is poor performance in comparing to native solutions. I would not advise building apps that are highly demanding in CPU or graphics card usage. Games, video/photo editing software are doable however their smoothness and responsiveness may not be acceptable for most of the use cases.

When using hybrid approach is a good idea
Hybrid apps are perfect for prototypes and simple applications. If you need to validate your idea and just see if a community is interested in your concept perhaps it is better to go with the hybrid approach. You can save some money and consider developing a native application in next phase. Applications like schedule/appointment planners, simple social and classifieds platforms, real-time chats, monitoring tools should work perfectly fine. The considerable advantage of such approach is cost-effectiveness and possibility for turning existing web apps into mobile apps. Simultaneous development of iOS and Android can be greatly accelerated by using libraries of ready to go components for a mobile user interface. It can save time that is necessary for adjusting apps to best practices that are very different for each platform.

What is the difference between progressive web apps (PWA) and hybrid mobile apps?
Hybrid mobile apps use individual plugins that expose platform-specific class methods (written in Swift/Java) to Javascript API. PWA is working slightly different. For now, you can use service workers or load your PWA from home screen, and that is pretty much all. If you need to access some native functions like GPS, microphone or camera then you need to utilize some of the HTML5 components.

How to start with developing hybrid mobile apps?
I would advise starting with Apache Cordova which is an open-source framework that enables you to build mobile applications using HTML, CSS, JavaScript instead of platform-specific APIs. There are also plenty of projects that are made on top of Apache Cordova. In my opinion, especially Ionic and Framework7 are worth checking. Cordova project creation itself is straightforward, and it comes to couple simple steps. Before the start, you need to install Node.js and some platform-specific dependencies (for example JDK for Android). Below you can see a short video with an example of Hello World Apache Cordova application.


Alternatives to Apache Cordova
React Native is a very trending JavaScript framework that lets you build cross-platform applications. React Native has much better performance than Apache Cordova as under the hood it uses native components. Additionally, we need to remember that Cordova is running inside WebView component. JavaScript is single-threaded, so if your app is trying to do too many things at the same time user experience might not be perfect. The big advantage of RN over Cordova is that React Native has three threads (four on Android 5+). For instance, one thread might be responsible for computing your UI and the second one can actually take care of your background business logic. Thanks to Facebook support React Native tooling is very vibrant.

Xamarin allows you to develop cross-platform applications using C# language. This platform also has better performance and responsiveness than Apache Cordova, however, Xamarin is not that easy to learn as you need to be familiar with Xamarin IDE and Android/iOS platforms.


Artur Chmaro

Full-stack Developer.

Artur is a full-stack developer currently living in Szczecin, Poland. His favorite technologies are Ruby on Rails, NodeJS and React. Founder of the biggest Polish portal about MMO games and new e-sport gaming portal. When not working, Artur is often spending his time on bike trips and reading fantasy books.

https://chmaro.com


Comments

4 odpowiedzi na “Cross-platform mobile apps with single codebase”

  1. Andrzej Śliwa napisał(a):

    „Xamarin is not that easy to learn as you need to be familiar with Xamarin IDE”

    This is same true for all platforms which you as developer don’t know yet.

    Xamarin have huge potential because its let’s you build native apps which have common core (business domain, transport layer, authentication and authorization) and separate views for iOS and Android (with native platform specific components and Look and Feel). C# is also very good and solid language. Of course learning xamarin require some investments but can pay off in many use cases. React Native or Ionic have own benefits. Ionic can be great option for fast prototyping, for making business applications without rich UI, VR or Graphics. But still it depends from web views which are facing some integrations problems with every release of new iOS or Android release. React Native is interesting because of react architecture and ecosystem, interactive development and ability of using native components but still have own limitations. Still Xamarin as platform for hybrid applications looks like strongest player. Of course very often decision about using specific platforms is driven by knowing already JavaScript, Angular or React, but not always this is decision driven by “best tool for the job” but rather “I know Hammer, I see nails everywhere” 😉

    • Artur Chmaro napisał(a):

      I didn’t have a chance to check Xamarin on my own, but as this is a mature and popular technology I’ve decided to mention it in this post. By sentence „Xamarin is not that easy to learn (…)” I only mean that entrance barrier is higher for Xamarin than for Apache Cordova (web developer point of view, for experienced c#/c++ developers it might not be a case ). Need to edit this paragraph, so it won’t confuse other readers.

      I fully agree with „best tool for the job” strategy.

  2. Andrzej Śliwa napisał(a):

    For many simple use cases you can also use Rails + Turbolinks (Web/iOS/Android) : https://youtu.be/SWEts0rlezA

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

Trwa ładowanie