A few years ago I was looking around for a new smart watch and I stumbled accross the Amazfit brand. I had never heard of them but the Balance seemed just what I was looking for and so I got one. To begin with it was round and didn’t look like you had an iPod Nano strapped to your wrist. Secondly it had a two week battery life and used normal watch straps.
In fact the battery life was so good, it became a problem. Two weeks is enough time that could forget when you charged it last, so I decided to write an app to remind me. As it happens Amazfit devices run Zepp OS and have a fairly flexible and well supported app development system. The one drawback was that most of the documentation was in badly translated (Chinese to ) English and a bit patchy. So this post is a brief outline of what you need to do to get into app development. I am assuming you understand the basics of coding and app development.
Before you download anything you should first sign up for a developer account here. You need this to download tools and upload builds.
Setting Up the Environment
To get things working you need the following software installed.
- A code editor. This can be anything from Notepad to VS Code. It is purely for editing files.
- Node.js. Apps are written in Javascript and it uses Node as a framework. It is best to install the lts (long term support) version and use that.
- Zeus CLI. once node is installed you can use that to install the dev tool. This is a super simple command line program for writing, debuggng and previewing your app.
- Watch simulator. This is an app that simulates all the different Amafit devices and lets you test your app on them.
With all that done, you are good to go. Open a command prompt and navigate to where you want to keep your code. Then type in the following command.
zeus create hello-world
This asks you a couple of questions regarding what you want to build. Use the up and down arrows to make your choices. You can create an app, a workout extension or a watchface. Choose App. Next you choose which API you want to build against. The older the API (smaller number) the more devices it will run on, but the fewer features you can use. Three is a safe bet. Finally it asks you which of the samle apps you want to use. These are ready made samples you can run and edit as you see fit. Try them all out and see what they do and how they do it. You now have something you can run on your watch.
Coding and Debugging
In your command line, CD into the folder that was created in the last step. There should be a bunch of files and folders. Start the Simulator prgram and follow the instruction earlier for downloading and selecting a watch to test on. Now in your window type;
zeus dev
It will come up with a list of watches and you choose the one you want to test on. Press enter and it sshould compile the app. If you go the main Simulator window you should now see your app listed there. Click on the big Emulator button and once that has appeared, click on your app in the list and your app should run.
You can edit the code now and whenever you save anything, your app will be recompiled and sent to the simulator. Easy.
Preview the App
Once you have it working correctly, you will want to try it on a real device. First of all you need to put the Zepp app on your phone into developer mode. Then in the command line you type;
zeus preview
This brings up a list of devices. Choose your watch type. It will build the app and present you with a QR code. Scan this in the Zepp app and your app should install.
And that’s all there is to it. Happy coding, and no, I will not be taking questions. 😉
