Your first hosted app

A hosted app is an Open Web App that has all of its resources (HTML, CSS, JavaScript, app manifest and so on) stored on a Web server. This article provides an introduction to behaviors of hosted app in KaiOS.

A hosted Open Web App delivers all its content from a Web server, in the same way as a conventional Web site, along with an app manifest in the app's root directory. The app manifest provides details about the app such as its description, icons used to identify the installed app and so on. The details in the app manifest are then used to install the app to KaiOS devices. Once installed the app loads its content dynamically from the hosting Web Server, and is able to access other resources on the Web, such as a database on a Web server.

Within the KaiOS security model, hosted apps are defined as web apps. This means they are unable to make use of privileged and internal (certified) APIs : to be able to make use of these APIs the app must be delivered as a Packaged App.

In this section you will learn the main concepts for building hosted apps for KaiOS

Options for hosting your app

Where you host the app is up to you. If you haven't chosen a hosting solution, this section describes a couple of commonly used options worth considering.

GitHub

If the content of your Open Web App is static (HTML/CSS/JavaScript, but no server-side processing), GitHub Pages is a solid hosting option. It'll serve your manifest with the correct MIME type if you give it a .webapp extension. Github Pages

Generic hosting solutions

For dynamic Open Web Apps, those requiring server-side processing, you can use any generic hosting option (such as a Web server you may already own or have access to). You'll need to ensure the Web server offers the right capabilities. A number of hosting provider offer Web servers that are already tailored to the needs of hosted apps, such as Heroku. Google App Engine or Amazon App Hosting.

Mime type

If you want host your app own, Manifests must be served using the MIME type application/x-web-app-manifest+json, this configuration is required on your server:

NGINX

Add to your mime.types file this configuration

types {
  application/x-web-app-manifest+json webapp;
}

Apache

Add to your .htaccess file this configuration

AddType application/x-web-app-manifest+json         webapp

Java web applications

Add to your Web.xml file this configuration

<mime-mapping>
    <extension>webapp</extension>
    <mime-type>application/x-web-app-manifest+json</mime-type>
</mime-mapping>

Testing hosted apps

To install a hosted app into a KaiOS Simulator or onto a device for testing purposes, Using the WebIDE fill the Manifest URL to install and test it. Package or hosted App

Publishing hosted apps

You can publish your hosted app to KaiStore for publishing which described in the Submit to KaiStore section. Only just specified a manifest.webapp URL.