Installing Android Studio
LG Watch is based on Wear OS by Google. So, you need an Android development environment to develop LG Watch application.
See Android Developer site to set up the Android development environment on your PC.
We recommend using the newest Android Studio version and API Level 26 or higher.
Downloading LG Watch SDK Package
Download the LG Watch SDK package from LG Watch SDK and extract it into a directory. The LG Watch SDK package is composed as below.
The LG Watch SDK package includes:
- docs: Developer guide (this document) and API Reference
- libs: ObstructionHelper library providing obstruction area information
- samples: Sample application and source code using obstruction API
To test developed LG Watch W7 application, a target device is necessary.
On LG Watch such as LG Watch Sport, LG Watch Style and LG Watch W7, as well as on any smart watch based on ‘Wear OS by Google’, you can run and you're your application without doing any specific configuration.
New Application Development
Creating a New Project
Create an Android application project in the following order:
1. Select ‘New Project’ from the ‘File’ menu.
2. Fill in the required fields in the ‘Create New Project’ window.
3. Uncheck ‘Phone and Tablet’ and check ‘Wear’, select ‘ API 26: Android 8.0 (Oreo)’ in the 'Target Android Devices' window.
4. Select the activity type and click Next.
- Select “Blank Wear Activity”, “Google Maps Wear Activity” or “Watch Face” according to the characteristics of the application you intend to implement.
- If you select “Watch Face” for development, we recommend to determine whether it is the obstruction display or not through ObstructionHelper and not to draw the hour and minute hands using GUI if it is the obstruction display.
5. Fill in the ‘Activity name’ and the ‘Layout name’ you wish to add by default and click Finish.
Importing the Library
Import the library file provided in the LG Watch SDK package by the following steps:
1. Copy com.lge.wearable.ObstructionHelper.jar file in the libs folder of LG Watch SDK package to app > libs in the Project folder.
2. Add the import statement to the top of MainActivity.java file as follows.
Using the API
You can develop an application considering the obstruction area using API provided in ObstructionHelper.
For more information on API specifications, refer to docs > API Reference in the LG Watch SDK package or LG Watch API References.