Creating a custom watch face service class
In this section, we will proceed to create our custom watch face service class that will be used to invoke the methods within the watch face service API. This class will be responsible for allocating and initializing the resources that our watch face requires. Watch faces are services and shouldn't be confused with activities, as these types of services only accept touch input and voice commands as a form of interaction.
First, we need to create a new class called WatchFaceService
:
From the Project Navigator window, expand the wear section and select and expand the java section.
Next, right-click and choose the New | Java Class menu option:
Then, enter
WatchFaceService
to be used as the name for our class and click on the OK button:Upon clicking the OK button, the Android Studio code editor will open, as shown in the following screenshot:
Our next step is to write the code that will communicate with our Android wearable device. For this, we will need...