Shape brain Slice 1Created with Sketch. Slice 1Created with Sketch. Slice 1Created with Sketch. menu 1433522600_bubble + 1433522600_bubble copy Thumbs up icon 15

Cross platform mobile development

Written on: July 6, 2015

Cross platform development has always been tricky. A huge number of modern applications are restricted to a single platform, reducing their potential audience, either due to language restrictions or because of the additional effort of maintaining several versions of the same application. Even when companies decide to release their application on a different platform, sometimes that version lags behind the main platform in features and fixes.

On the desktop, cross-platform languages like Java can run on all platforms which have their runtime environment installed and frameworks like Qt allow developers to share the code between platform releases. More recently, the web gave developers a common framework for app development across almost all platforms through the browser.

With the rise of mobile platforms, the same issues have appeared. iOS, Android, Windows Mobile and newcomers like Ubuntu Touch and Firefox OS give people a huge variety of operating systems to choose from and that reflects on developers developing apps for these platforms.

Can you “write once, run everywhere” on mobiles?

Short answer: No.

Longer answer: No, you can’t.

Really long answer: Yes, but not through an app. Unfortunately, since there are multiple mobile platforms, each with its own preferred native language, there’s no single package which can be deployed to all mobile platforms and there won’t be one for the foreseeable future. So why did I answer ‘yes’ then? Because there’s something that all mobile platforms share: a web browser. This means that you can write an online mobile app once, deploy it on a server and make it available to every phone with a suitable browser. 

This also gives you the advantage of having a website to go along with your app. This, in combination with new browsers’ local storage and websocket features means that you can create something which looks and feels like an app but runs on the browser. There are restrictions to what you can do through the browser but most of the time a mobile-optimised website will satisfy your needs.

But... what if you want more?

Mobile-optimised website or mobile app?

Since mobile-optimised websites are so popular and browsers are so powerful, why would anyone want to develop a mobile app?

At the moment there are a few reasons for that. While most people nowadays have devices with support for fast 4G networks, their top speed isn’t always available, and even when it is, it’s not always reliable and is rarely unlimited.

But even in a free-4G-for-all world, browsers can’t really access native functions of the phone, like notifications, vibration, the file system and the various sensors. This means that no mobile-optimised website can have all the features of a mobile app.

Man in remote area

No 4G coverage here!

I’d really like to build an app! What do I need to do? 

As soon as you decide to build a mobile app, you are faced with a choice: which platforms should you target? Is iOS the obvious choice? What about Android? Should that be a later iteration? Windows Phone is gaining popularity. Should you be the first to tap into the Ubuntu Touch market?

Man at desk, thinking

Choices, choices... 

The answer to this question mostly depends on the people you would like to reach through your app. iOS has a very big market share in Europe and the US, but most low-end smartphones in the world run Android.

Let’s say for simplicity’s sake that you decide to target iOS and Android with no plans to expand to other platforms. iOS uses Objective-C (although Apple’s Swift language may change that) for applications and Android uses Java. As you expect, this means that they are not compatible with each other, so you will have to build two apps, one for each. That’s almost double the effort and possibly double the cost and that applies to the initial iteration and any additional features you decide to add in the future.

Can’t I build one app for all mobile platforms? 

Remember the one thing that all mobile devices have in common? Exactly! The browser will once again come to the rescue. The amazing open source community, and specifically Apache, has created Cordova; an interface for building mobile apps as if you were using a browser. This allows you to use browser technologies like HTML and Javascript to develop apps for multiple platforms and build native packages for each one without changing the code itself. Not only that, but it provides usable interfaces to some of the phone’s sensors and native functions like vibrations and push notifications.

Lots of mobile devices

All of these have a browser but can't agree on anything else

Several frameworks were built on top of Cordova like PhoneGap and Ionic, each one adding its own features, to make developing mobile applications as simple as can be for as many platforms as possible.

One app for all mobile platforms? What’s the catch? 

The truth is that even though this method for developing mobile apps is convenient, it’s not without its caveats.

Since the apps run in a browser, even though they do it locally without requiring internet access, they will not have a native user interface or be able to access to all the features of each phone.

Not using a native interface means that sometimes the apps will look a bit ‘off’, especially on platforms with strongly-defined interfaces like Windows Phone. In addition, non-native apps don’t perform as well as native apps, because of the additional layer they add. Also, because of the wide-ranging feature sets of different phones, you end up using a common feature set of all the phones you will target.

Should I build a native app? Or use a “write once, deploy everywhere” framework? 

As expected with this type of question, there’s no definite answer. For most cases, a mobile-optimised website may be the way to go. However, if you have the budget and the target audience requires is it, you may want to create an app instead.

We’re more than happy to give you some guidance on the right mobile development route for you. Please contact the Bright Interactive team for a chat.

Written by