With the rapid advancement in the technology, wearable devices top the trends. They come with advanced processing powers, sensors, display quality, communication channels and long lasting battery life which attracts the people around the globe. These features improve productivity, improve customer relations and better communication.
Wear OS applications run straightforwardly on a watch, giving you access to equipment, for example, sensors and the GPU. Wearable applications are like different applications that utilize the Android SDK, however, a contrast in structure and usefulness. A Wear application should work autonomously of a telephone application, permitting clients the best adaptability in their selection of telephones. So, let’s look after some basic procedure for building an application of a wearable device.
Set up Environment
Firstly, you should install the latest version of Android Studio. It is recommended to use the SDK manager to confirm that you have the latest version of Android. Now, under the SDK Platforms tab, click Android 8.0 (Oreo).
Begin by Creating a Wear OS app
It is created using Android Studio’s New Project wizard.
Start a project
Follow the given steps to start a project in Android Studio:
- Click File > New > New Project.
- On the Configure your new undertaking screen, acknowledge the default esteems and click Next.
- On the Target Android Devices screen, select just the Wear choice, and in the Minimum SDK list, select the most recent accessible alternative.
- Click Next, and Add an Activity to Wear screen, select Blank Wear Activity and click Next.
- On the Customize the Activity screen, click Finish.
- In the build.gradle file, record the application module.
- In the Android Manifest document (AndroidManifest.xml) of your application, show that your application is independent. In particular, include a meta-information tag as pursues:
- In the Android Manifest record, guarantee the <uses-feature> tag is characterized. At any rate, it must be characterized with android:name=”android.hardware.type.watch” as pursues:
<uses-feature android:name=”android.hardware.type.watch” />
- Match up your Android Studio venture. To run the code in the new module, see Launch the emulator and run your Wear OS application.
Launch the emulator to run the application
Android Virtual Device has to get configured for using the emulator along with the latest version.
- In Android Studio, open the Android Virtual Device Manager by choosing Tools > AVD Manager.
- Click Create Virtual Device.
- In the Category sheet, select Wear and pick an equipment profile. Click Next.
- Select the O picture to download. For instance, select the picture with the Release Name of O, the API Level of 26, and the Target of “Android 8.0 (Wear OS)”. Snap Next and after that click Finish.
- Close the Android Virtual Device Manager.
- In Android Studio, tap the Run catch.
- Select the new AVD, and click OK.
Sync your phone with AVD
This method of synchronizing is used to operate your Google account with the wearable device.
- Pursue the means for setting up a phone.
- On the phone, empower Developer Options and USB Debugging.
- Interface the phone to your PC through USB.
- Forward the AVD’s correspondence port to the associated phone (each time the telephone is associated):
adb – d forward tcp:5601
- On the phone, in the Wear OS application, start the standard blending process. For instance, on the Welcome screen, tap the Set It Up catch. On the other hand, if a current watch as of now is matched, in the upper-left drop-down, tap Add a New Watch.
- On the phone, in the Wear OS application, tap the Overflow catch, and after that tap Pair with Emulator.
- Tap the Settings symbol.
- Under Device Settings, tap Emulator.
- Tap Accounts and select a Google Account, and pursue the means in the wizard to match up the record with the emulator. On the off chance that essential, type the screen-bolt gadget secret word, and Google Account secret key, to begin the record adjust.
Adding a Wear OS module to the project
Open your existing Android Studio project to add a Wear OS module as follows:
- Click File > New > New Module.
- Select Wear OS Module in the New Module window and click Next.
- Under Configure the new module, enter the following modules:
|— Application/Library Name: This string is the title of your application launcher symbol for the new module.
—Module Name: This string is the name of the organizer for your source code and asset documents.
—Bundle Name: This string is the Java namespace for the code in your module. The string is included as the bundle trait in the module’s Android show document.
—Least SDK: Select the most minimal adaptation of the stage that the application module bolsters. For instance, select API 26: Android 8.0 (Oreo). This esteem sets the minSdkVersion quality in the build.gradle document, which you can alter later.
- Click Next. Alternatives that incorporate code formats are shown. Click Blank Wear Activity and click Next.
- In the Configure Activity window, enter or acknowledge the default esteems for the Activity Name, Layout Name, and Source Language. Click Finish.
End of the Line
More companies are manufacturing smart watches along with the traditional companies due to its huge demand. Wearable devices prove to be a boon in daily life. It gives quick access to notifications, personalized information, tracks health, makes calls and sends messages, navigate the routes and new watch faces every day. Hence, the wearable devices make us stand ahead by upgrading to different system architectures and technologies.
Charles Richards working as a Business Analyst at Tatvasoft UK a leading software development & web development company in London. Besides of his profession Richards likes to share some new and trending technical aspects.