About Migrating Fog of World to Android

Ollix
Fog of World
Published in
2 min readNov 29, 2017

When I started developing Fog of World 2 in 2014, I knew that I would migrate the app to other platforms someday. That’s why I created a cross-platform development framework by my own and Fog of World is built on top of it. Almost the entire app is written in C++. I even designed my UI system, and thus the app does not rely on the UIKit from iOS. In English, which means Fog of World 2 can run everywhere with the same look and feel, without changing any single line of code.

So what will it take to migrate Fog of World to the Android platform? Well, it’s a bit complicated. In the past three years, Android has changed a lot. The first-class official programming language for Android now is Kotlin instead of Java. Also, the current build tool for Fog of World and its sub-projects is GYP from Google. It was able to build iOS and Android app out-of-box. However, Google decided to kill it, and now I need to port all the GYP scripts to Gradle and CMake scripts so we can build the Android app.

On the other hand, Fog of World uses some platform-specific libraries to support third-party services like Dropbox, Google Maps, etc. In iOS, these libraries are written in Objective C, so I needed to create bridging code to call these platform-specific APIs from C++. In Android, these libraries are written in Java or Kotlin. Therefore I need to rewrite a lot of bridging code for communicating with Java/Kotlin APIs.

Moreover, the logic behind iOS and Android may be very different. For example, the asset files bundled in Android’s APK file cannot be accessed without special care. The most time-consuming task will be testing how location service works on roads. I will need to find out the best parameters to filter out inaccurate coordinates while recording as many tracks as possible. Driving, walking, transportation. There’s no efficient way to accomplish it in a few days. It may take a long time.

--

--