Kotlin for Pebble
The best Smartwatches are Pebble. Even taking into account that the company producing them was sold, and there will be no more new devices it is still best smartwatches you can buy.
First, you need to follow this https://developer.pebble.com/sdk/install/ instructions to setup PebbleSDK. Also, you need to setup Kotlin command line tools. I am using SDKMan 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. The first thing to check here is
build.sh script. It has three steps:
- Remove unused code with help of
pebble buildto actually produce artifact for Pebble
- The last step which is not the part of the script — installation — you can use different options of
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
- KotlinJs standard library could be found in kotlinjs folder. It is huge but
kotlin-dce-jsis there to fix this.
- And finally, kotlin folder contains bindings to js code(for example
ui.kt), some helper functions in
app.kt— the application code.
If you build and run this code you’ll get typical Hello world app like this:
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) with a support of STM32 chips. But that is a story for another post.