Version: Smart Feature Phone 2.5Version: Smart Feature Phone 3.0

Storage

There is no limit to application size or storage size, except for physical storage constraints.

App size range depends on the complexity of the app. Below some internal KaiOS apps’ sizes for your reference:

  • Calculator: 200KB
  • Settings: 10MB

Data Storage

The aim of this guideline is to provide information for app developer saving data in a better way due to smart feature phone is not like smart phone usually with large data storage.

To prevent user hit storage full issue with unexpected scenario, KaiOS needs app developer’s support to follow the guideline below for better user experience.

  1. Media file should be saved in media storage, NOT in application data as indexedDB.

  2. KaiOS system will block DB writing once remaining data storage size is lower than 30MB, so each app must do error handling. (the number may be difference based on device)

  3. App developer should handle the content carefully and set some limitation especially for low storage devices. For example, to limit the total size of content such as the number of messages to 10000 or contact number to 1000, once the number is close to the limit, to show the error message or overwrite the older data.

  4. KaiOS provides a preventive action to keep device working normal as usual when storage is full by large size of indexedDB. It will perform data storage clean up by deleting old, removable indexedDB. To delete the object properly, KaiOS needs app to mark indexedDB when creating DB for those data which is considered “can be deleted” while storage full. App Developer should be aware of:

    * The storage type for these IDB is "temporary" which will be all removed when available space is lower than a threshold.
    
    * For IDB guideline, developer could refer [this link](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) since the rest of usage is the same as normal database.
    
    * App should support error handling and upgrade situation when the indexedDB is removed.
    
    * Method to Create/Delete removable indexedDB as following:
    

To request opening a connection to a database that able to be deleted when space needed:

Syntax: var IDBOpenDBRequest = indexedDB.open(name, { version, storageType });
var db;
var DBOpenRequest = indexedDB.open('MyTestDatabase');

DBOpenRequest.onerror = function(event) {
  alert("Why didn't you allow my web app to use IndexedDB?!");
};

DBOpenRequest.onsuccess = function(event) {
  db = event.target.result;
};

To request deletion of a database which in temporary storage type:

Syntax: var IDBOpenDBRequest = indexedDB.deleteDatabase(name, {
  version,
  storageType
});
var DBDeleteRequest = window.indexedDB.deleteDatabase('toDoList', {
  version: 4,
  storage: 'temporary'
});

DBDeleteRequest.onerror = function(event) {
  console.log('Error deleting database.');
};

DBDeleteRequest.onsuccess = function(event) {
  console.log('Database deleted successfully');
  console.log(event.result); // should be undefined
};

For small size records and application data, the Web Storage API provides access to session storage or local storage, allowing you to add, modify, or delete stored items.

Device Storage

For access to specific files in a specific storage area on the device, the DeviceStorage interface is used.

navigator.b2g.getDeviceStorage() will return a DeviceStorage object which you can then use to access content of the storage area.

MDN Resource

You can refer Using IndexedDB for more information.