Getting started with Cross-Platform Mobile App Development
What we came up with was a good old raffle.
To participate in the lottery we needed some kind of a simple quiz on our smartphones … or tablets … or laptops? That’s where my journey started. And after seven years I was once again looking into the way of writing apps. I did my last app for Android 2.x during my bachelor’s thesis in 2012 and, I think we all agree that seven years is quite a while in the world of frameworks and programming.
I wanted to code a small app, but I didn’t want to dig deep into frameworks or learn a new programming language for this rather small challenge. I wanted to keep things simple. For conferences we usually use iPads, and I did some Objective C programming in the past, but Swift is now the big thing. As I am working on a Linux distribution, developing any iOS App was not that easy. At that point I had to figure out which ways of creating an app were even possible. I had the following in my mind:
> Native Apps: I could write a native app directly for Android or iOS. But – as already mentioned – I am working on Linux distribution, so native iOS development wouldn’t be that easy... or even possible.
> Responsive website: I could do a responsive website so that I am free of any hardware choice. But then I would have to take care of a web server as well … and I wanted to keep it small and simple.
> Web App: Then there are those progressive web apps building on service workers that I already took a deeper look into, but somehow it would be a website again, right? (Remark: Progressive web apps are a type of a mobile app delivered through the web, built using common web technologies.)
> Cross-platform: Or finally I take a deeper look at the current cross-platform frameworks. Even if I have the gut feeling that they don’t feel right on the smartphone, they are maybe worth having a look at. It was obvious that I won’t develop a native app, because not only that I am not able to have a running Xcode (the IDE for developing iOS apps) on my machine, but also I wanted to include colleagues, whereby most of them also work with Linux distributions. Additionally the website and progressive web app was not an option for me. Even if writing a small and secure web server is not a big deal, I didn’t want to investigate how to get that server running outside and now be reachable not only inside our cluster – remember: I wanted to keep it small and simple. That’s why a cross-platform framework had to fulfill my needs. But which one should I take? PhoneGap, Xamarin, React Native? It seems that those frameworks are extremely volatile, new ones are being released on a regular basis, but I wanted to keep the app for a few more conferences rather than only that one taking place in Berlin.
As you can see in this example, we have a little stateless widget, which overrides the build method and returns a Material designed component. This component has different properties, which are objects again. Pretty straightforward, but somehow nested.
As these tools get more advanced, the “code once, deploy twice” Holy Grail gets closer. Perhaps one day, we can really build an app once, and run it anywhere.