I’ve been tinkering with the KaiOS platform for some time now and in this post, I’ll try to sum up everything that I’ve learned about it — its application ecosystem, devices, and basically, everything that would help you to:
So let’s begin!
KaiOS uses Firefox v48 (in the latest stable release v2.2.0) to run web applications, basically using it as its JS runtime and rendering engine on top of a Linux kernel. More info on this can be found here.
Its technical details notwithstanding, KaiOS — with its limited support for the cutting edge JS features that are supported by all modern browsers — may appear to be outdated. This may also lead to a probable conclusion that the OS is not being maintained, because otherwise, they would have updated the Firefox version at least, right?
Well, not exactly! KaiOS depends on extensive support for Web APIs and Web Activities, which were also core to its predecessor — B2G. Now some of these Web Activities have been deprecated since B2G, and hence, upgrading the underlying Firefox version may mean losing those functionalities which are essential for app-to-device and inter-app communication on the KaiOS platform.
PS: The official documentation does mention that KaiOS supports Firefox up to v59 for development.
I imagine you’re asking — “Why should I care about a mobile OS that I haven’t heard about, seen anyone using, or used myself?”. Well, the answer lies in the target audience and actual adoption figures for the platform, and these might take you by surprise.
KaiOS is the third-largest mobile OS by market share in the world and the second most used OS in India, thanks to the Jio Phone lineup.
To understand the phenomenal growth of the platform, we need to look at the company’s goal, which is to get the next billion online. This demographic includes people from developing countries who have never used a smartphone before and can’t get a hold of one for a multitude of reasons.
Apart from the reach that KaiOS offers, another very compelling reason to build for KaiOS is the extremely low bar for entry.
If that doesn’t tickle your curiosity, it might be helpful to note that several key players have partnerships with KaiOS, some of whom have their apps on the KaiStore already.
Okay, so now I hear you ask — if it’s such an amazing opportunity with such a low bar for entry, why aren’t more people going after their slice of the pie here? And that’s a very valid question.
The answer lies in how the KaiOS ecosystem handles monetization on its store, which, to be honest, isn’t very lucrative.
Currently, the only way to monetize applications on the KaiStore is by integrating their homegrown KaiAds SDK. In the very minimal sense, you can think of it as a counterpart to Google’s AdSense.
So in short, you need to add this SDK to your app and probably link it to a container element (for non-full-screen ads), and then trigger the ads on either user action or page load/transition, etc.
NOTE: Integrating the KaiAds SDK is also sort of mandatory, as KaiOS recommends that you always monetize your apps, and if you don’t want to, you’ll have to give a reason while submitting your app to the KaiStore for review.
Now, this approach has a few glaring issues:
Revenue is controlled by KaiOS. So all impressions get credited to your KaiAds account (which has a pretty bare-bones dashboard for insights on your ads impressions), but you can only cash out once you hit the $500 mark. Now that’s a pretty steep incline given the lack of relevant ads and the scarce user base your app will probably have. And after all of that, KaiOS will keep a whopping 70% of the revenue. Yikes!
Here, is a link to an official response from the KaiOS team on a Reddit thread addressing the issue. To be fair, some of their points do actually make sense when you look at the bigger picture. #JustSaying!
Also, here are some best practices that KaiOS suggests for app monetization on their platform.
Now that we have that out of the way, let’s talk development.
To get your existing web app to work on a KaiOS device, you just need to consider the following 3 things:
manifest.webappto your project
For the development environment you have 2 paths to choose from:
If working with a physical device, you’d probably need the following installed and configured:
To break it down, Firefox is required to be used as a Web IDE from where to install your application on the test device and debug it using Firefox’s Developer tools (since the app is essentially a web application)
ADB is required for setting up the communication channel between your device and Firefox.
Detailed instructions for installing and setting up Firefox and ADB can be found here.
And here’s another very helpful article for troubleshooting USB debugging issues.
There are basically 2 simulators available that could enable you to get started with KaiOS development without a physical device:
Note that using a simulator would certainly limit you, as it is not adequate for testing device APIs.
Instructions for installing and using the simulator can be found here.
As we already know, KaiOS apps are basic web applications with the addition of a single manifest file.
manifest.webapp file has certain components that are required, and some that are optional. You can learn about all of them in detail in the official docs.
Just like every other mobile OS out there, KaiOS has a set of permissions that dictate what access an app has, and also categorizes apps as Trusted and Untrusted applications.
As you’d expect, the recommended path is always the “Principle of Least Permissions”.
Since the KaiOS ecosystem is based on web technologies, the permissions don’t just deal with access to device APIs. They might also restrict or allow access to Web APIs, such as
A whole list of permissions can be found here.
Bonus tip: the list of permissions can also be found in the official Linux simulator and Palemoon Web IDE.
Applications are distinguished on the basis of their trust level and on the basis of how they are served on the platform.
When talking about trust level, the 3 broad categories of application are:
When talking about how the app is served, note that there are only 2 types:
.zipfile containing your web app. For instance, if it’s a React app, just create a build and zip the
buildor whatever your output folder is. (Make sure that the zip contains the
manifest.webappfile — that is the only thing stored locally on the device, and everything else would be fetched from the remote server when the user accesses the app.
NOTE: Privileged apps can’t be hosted!
So all talk and no action makes this a dull post, right? In this section, we’ll talk about actual code, boilerplate stuff, and some awesome stubs that will help get you started right away.
These are just a few specific sections that I thought were worth mentioning. If you want to delve deeper, though, the KaiOS team has put together a pretty decent developer portal that you can go through in detail.
In this section, I’ll include some awesome GitHub repositories, blogs, and articles that I think would be really helpful to anyone developing apps for KaiOS (and also fill in a big void left by the official documentation).
There are a couple of minor caveats that you need to be aware of while developing your KaiOS application:
webpackincludes an inline script in the output. To avoid that, set the environment variable:
/index.html. This happens because packaged application resources are served using
app://URL pattern. Since there’s no webserver mapping all requests to
index.html, it would just search for matching resources based on the current route, which would, obviously, break. Hosted apps are not affected by this since the requests can be handled as normally done using a web server.
kdeploywhich is no longer available and hence running
npm iwould fail. There’s an alternate package —
@filipe_x3/kdeploy(available here) — that you can use instead. This package basically helps in packaging and installing apps directly on a connected physical device over
Finally, you can head over here to cross out all the prerequisites for app submission and then scoot over to the KaiOS app submission portal to submit your app for review and get it published on the KaiStore.
Please note that the Jio store is a separate marketplace maintained by RIL and there’s no app submission portal for the Jio store available yet.