Rumor on the street has it that there is no API for making watchfaces.. Well, that's just plain wrong. I've been working with Daniel "Master of Time" Ortiz, aka @kuronosan. We've worked out a ton of the details in order to make watchface APKs easy! It's as simple as making some png resources and then putting code behind them. You just need a framework and that framework is right here! We are going to squash that "no API" rumor here and now. We've not only got the APis here, we've added nice things like transitions which you won't find on many of the other watches!
What's it all about?
This package consists of 2 major parts, the Mobile App, and the Wear App.
The mobile app's job is to deploy the Wear app and provide an icon/view which gets installed in the app drawer, allowing the user easy access to uninstallation. After the Wear "MicroApp" App is deployed, this application serves little function. Its a little funny as the MicroApp is much larger than the primary app due to resources
The Wear App has two entirely different activities built into it; Analog and Digital. Wear applications are basically live wallpapers. They use the Background Provider permission and they have a few additional properties such as the need to react to the DisplayManager's Screen On, Screen Dim and Screen Off commands. Aside from this, they are simply eye-candy.
The Digital section of this watch was written entirely from scratch by yours truely. I found that the animations involved in watchfaces can bloat an activity significantly. So, I use Java Inheritance to extend the classes in order to logically separate things in this way
- DigitalWatchfaceActivity - Handles setting up the views and intent receivers for date/time/battery and updating the time
- DigitalWatchfaceActions - Handles PowerManager commands and aesthetic elements such as animations/transitions.
- DigitalWatchfaceApp - Used to launch the activity, reserved for future use.
Watchface-Gears has provided an awesome starter for Analog Watches. Rather than reinvent the wheel, we've used their base. I had to rework a considerable chunk to add in fading transitions and refactoring for analog/digital separation. When all was said and done, between mine and Daniel Ortiz's work, the only thing that's original is Watchface-Gears library. We kept Watchface-Gears in tact because it is an awesome library. It also set the license used throughout the project. (Apache)
How do I make my own?
Here's how you get started. Being that this is mostly artwork, I can't tell you "how" to do it... But, I can do what to do.
- Download the source.
- Load it into Android Studio
- Modify the package name suffix (watchface/gradle.properties: currentApplicationIdSuffix=MyCustomWatchName), and make it unique string, so when you generate a signed APK it doesn't collide with mine or others. Better yet, you should rename the entire package but that is a detailed operation.
- Modify both the Mobile and Wear (watchface/wear/src/main/AndroidManifest.xml & watchface/mobile/src/main/AndroidManifest.xml) files to rename the watch faces and app names for the Wear Picker.
- Build the package now to verify it works after you've changed properties.
- If you want to customize the Analog watchface app, all you need to do is modify the PNGs in watchface/wear/src/main/res.
- If you want to customize the Digital watchface app, you will rework both the wear/src/main/res/layout/digital_watch_layout_awake.xml and the wear/src/main/res/layout/digital_watch_layout_dim.xml. These are standard Android XML layouts.
- If you don't want to use the Analog or Digital, remove the AnalogWatchfaceActivity's or DigitalWatchfaceActivity's <activty> entry from watchface/wear/src/main/AndroidManifest.xml
- When you're done with the layouts, update the PNG files in watchface/wear/src/main/res/drawable with screenshots for the Background Provider picker (shown near the bottom).
see attached images
Transitioning through Background Providers:
Downloads and Source
You can get source here: https://github.com/adamoutler/watchface
Download it free here: https://play.google.com/store/apps/d...LWatch.release
Get the donate version and give me an excuse for my wife here: https://play.google.com/store/apps/d...ev.CASUALWatch