Orbital Classic Example: Instructions


Overview

This example will show you how to create an Android app that contains one or more Watchmaker faces. Anyone installing it on a phone will automatically find those faces in Watchmaker under My Faces. The app itself can be run and will display whatever instructions or explanations you would like people to see.

If you have not already installed Android Studio you should do that first. Then download OrbitalClassicExampleforWatchmaker.zip from this site. Unzip it into the workspace for Android Studio. It is a fully-functional project for my Orbital Classic watchface.

Do not rename the project directory yet! You need to do some things to prepare it first or you will run into problems.

Start Android Studio and select "Open an Existing Android Studio project" from the menu. Select the directory named OrbitalClassicExampleforWatchmaker that was created when you unzipped the file above. That will load the project into Android Studio so you can modify and build it.

Editing

Since this project was setup for my Orbital Classic face you will need to make some changes to the existing files. Make sure that the drop-down at the top of the Project pane is set to "Project" or the instructions for where to find things will not match up.

In app → src → main → AndroidManifest.xml:

You will need to change the package name to one of your own. Make sure that ".wmwatch." is part of your package name too or Watchmaker will not look for .watch files inside it.

Look for the line that begins "package=" and select the entire package name "org.aslanrefuge.apps.wmwatch.orbitalclassicexample". Right click on it, select Refactor, select Rename, click Rename Package, enter your own package name in the box, and click Refactor. You will see a list of all the components that this will change. Click Do Refactor.

Set the android:versionCode and android:versionName to whatever you want. Note that an APK with a lower versionCode cannot be installed on top of one with a higher versionCode. Be sure to increase that value for every release you put out.

In app → src → main → res → values → strings.xml:

Change the app_name from "Orbital Classic Example for Watchmaker" to whatever you want to name your application.

In the Project pane:

If the arrow at the top of the pane points to the right click on it to expand the project list. Click the gear icon in the upper right corner and uncheck "Hide Empty Middle Packages". Find for "OrbitalClassicExampleforWatchmaker.iml", right click on it, select Refactor, select Rename. Don't change the .iml extension, but change the rest of the name to match the new name of your application, then click Refactor.

Renaming the project directory:

At this point you should select File, select Close Project, and click the "x" in the upper right corner to close Android Studio. Now use a File Explorer window to rename the Project directory from "OrbitalClassicExampleforWatchmaker" to your new name. (This is the directory that was created when you unzipped the file.)

Now that things have been renamed you can start Android Studio again. Select "Open an existing Android Studio project" and open your newly-renamed Project directory.

In app → src → main → assets -> article.html:

Use simple HTML to create the scrollable page that will appear when your app loads. I use this to provide instructions on how to load the watch faces into Watchmaker and to explain their features.

In app → src → main → assets:

Copy your .watch file or files into the directory app\src\main\assets\ within your Android Studio project directory. Any watch files you put there will automatically be loaded into My Watches by Watchmaker when your application is installed.

In app → src → main → res → mipmap-xhdpi:

Create an icon file for your app and copy it to app\src\main\src\mipmap-xhdpi\ic_launcher.png within your Android Studio project directory. The icon should be a 96x96 pixel PNG file (and you can use transparency).

Building

You are now ready to create your app. Select Build → Generate Signed APK from the menus. I'm afraid that signing an app is beyond the scope of this article. See the Android Studio User Guide section named Sign Your App for instructions on how to create, store, and use a signing key.

Once Android Studio has created your signed APK you can upload it to Google Play or distribute it in any other way you like.

Conclusion

Please email me if you have questions or run into problems. I will do what I can to help.

--Bob Quinlan