The best Smartwatchs are Pebble (opens new window). Even taking into account that the company producing them was sold, and there will be no more new devices it is still best smartwatchs you can buy.
First, you need to follow this https://developer.pebble.com/sdk/install/ (opens new window) instructions to setup PebbleSDK. Also, you need to setup Kotlin command line tools. I am using SDKMan (opens new window) for that. As soon as you have all that you are good to go.
So, I’ve made a fork of pebblejs repo — https://github.com/gimlet2/pebblekt (opens new window). The first thing to check here is build.sh script. It has three steps:
- Remove unused code with help of kotlin-dce-js
- And pebble build to actually produce artifact for Pebble
- The last step which is not the part of the script — installation — you can use different options of pebble install command.
The last thing to focus on — src folder:
- in js folder you will find original PebbleJS SDK. Also a result of Kotlin transpiling is also could be found here in app.js file.
- KotlinJs standard library could be found in kotlinjs folder. It is huge but kotlin-dce-js is there to fix this.
- And finally, kotlin folder contains bindings to js code(for example ui.kt ), some helper functions in pebble.kt and app.kt — the application code.
If you build and run this code you’ll get typical Hello world app.
With this project I want to try to expand Kotlin to a new platform. Worth to mention the latest release of Kotlin-native (0.6.0 (opens new window)) with a support of STM32 chips. But that is a story for another post.