Clock alarms: how to customize and replace the stock clock app
(safe method)
The application that takes care of the clock alarm is located in /system/b2g/webapps/clock.gaiamobile.org, you can safely extract it from the system ROM using the command:
adb pull /system/b2g/webapps/clock.gaiamobile.org
however, this app differs from one device to another, in particular as regards the detection of multimedia files used as sound (MP3, OGG, OPUS ...) all located in the internal /shared/resources/media/alarms folder of the application.zip file.
This guide aims to get around this by downloading and modifying a simpler version of the Clock app, from a Nokia 8110 4G, so that you can install it on any KaiOS phone, using WebIDE or manually replacing it on /data, without losing updates.
Download and editing
Download and extract the Clock app of the Nokia 8110 4G from this link, then explore the application.zip file to the /shared/resources/media/alarms folder, containing all the audio files and list.json, the list of all these tracks with the name that must be shown on the menu. On the Nokia 8110 4G the file contain this:
{
"Alarm_Clock_1.opus": {"l10nID": "Alarm_Clock_1"},
"Alarm_Clock_2.opus": {"l10nID": "Alarm_Clock_2"},
"Alarm_Clock_3.opus": {"l10nID": "Alarm_Clock_3"}
}
There are some alarm clock hidden into the Clock app, to enable all of them just copy and paste this:
{
"ac_africa.ogg": {"l10nID": "Africa"},
"ac_amazon.ogg": {"l10nID": "Amazon"},
"ac_disco.ogg": {"l10nID": "Disco"},
"ac_fairy_tales.ogg": {"l10nID": "Fairy_Tales"},
"ac_fresh.ogg": {"l10nID": "Fresh"},
"ac_galaxy.ogg": {"l10nID": "Galaxy"},
"ac_mojito.ogg": {"l10nID": "Mojito"},
"ac_techno.ogg": {"l10nID": "Techno"},
"ac_woody.ogg": {"l10nID": "Woody"},
"Alarm_Clock_1.opus": {"l10nID": "Alarm_Clock_1"},
"Alarm_Clock_2.opus": {"l10nID": "Alarm_Clock_2"},
"Alarm_Clock_3.opus": {"l10nID": "Alarm_Clock_3"}
}
As you can see, it's sufficient to add a line. For example, if you add a SAMPLE.mp3 file in /shared/resources/media/alarms you must write this line:
"SAMPLE.mp3": {"l10nID": "SAMPLE"},
Where "SAMPLE" is the name of the track that will be shown on the list. Use the JSONLint website to verify that the format is correct for any json file you want to modify.
NOTE that most likely the name of the track you have chosen will not appear, you will probably have to find out how to add it in the two files panel.html which are located in the "alarm_settings" and "alarm_edit" folders, both placed in /js/panels, but this is an issue that you can simply ignore if you have chosen your favorite song as your alarm clock .
How to replace the stock one
To install our custom Clock app, use WebIDE, like any other third party app. The only problem though is that we will have two Clock apps in our menu. The first option to solve this problem is to uninstall the existing one through the appropriate guide, as I have already mentioned at the top of this page... or alternativelly, the second option is to replace the stock one in /data manually, like this:
Push the app and its folder on the data partition, exactly in /data/local/webapps using a temporary root access:
adb push clock.gaiamobile.org /data/local/webapps
Get the webapps.json file:
adb pull /data/local/webapps/webapps.json
And change the value of the clock.gaiamobile.org app
"basePath": "/system/b2g/webapps",
in this way
"basePath": "/data/local/webapps",
Use again the JSONLint website to verify that the JSON file format is correct.
Afther this change push the webapps.json file in its place and reboot the phone:
adb push webapps.json /data/local/webapps/
adb reboot
After rebooting you have your personal alarm clock to choose on the list!
Being a safe change, the stock app will be restored after a factory reset or after the OTA update.