LG Wing

DOWNLOAD SDK

Download SDK

LG WingDownload SDK

Download

  • LG MultiScreen SDK version 1.0.0Jun 05, 2020153KB 다운로드
    · Added getSwivelState API for getting current swivel state of device
  • LG MultiScreen SDK version 0.7.0 alphaMay 06, 2020154KB 다운로드
    1. Supported Device : Wing Device, Wing Emulator
    2. Supported OS : Android 10

    · Initial release
    · Added APIs for multi-display support for LG MultiScreen device

Setup

Installing Android SDK

An Android development environment is needed to develop an application for LG Wing.
Set up the Android development environment by referring to the Android developer site.

Go to Android Studio

Downloading LG MultiScreen SDK Package

Decompress the LG MultiScreen SDK package in the specified folder.

Test Environment

The developer needs a target device or an emulator for LG Wing to test an application developed for LG Wing.

Test your app on LG Wing Emulator

Refer to the LG Wing Emulator User Guide.

Development

This section describes how to develop applications for LG Wing.

Creating a New Project

Create an Android application project, as described below.

  1. 1. Select File > New > New Project… from the Android Studio menu.

    Select File > New > New Project… from the Android Studio menu.

    Enter “Start a new Android Studio project” on the Welcome to Android Studio to start Android Studio without the project.

  2. 2. Select Empty Activity in the Phone and Tablet tab on the Create New Project screen and click the Next button.

    Select Empty Activity in the Phone and Tablet tab on the Create New Project screen and click the Next button.

    Select an activity according to the type of the application to implement.

  3. 3. Enter information, such as the Name, Package name, and Save location, on the Configure Your Project screen, select Java and API 29: Android 10.0 (Q) for the language and SDK, and then click the Finish button.

    Enter information, such as the Name, Package name, and Save location, on the Configure Your Project screen, select Java and API 29: Android 10.0 (Q) for the language and SDK, and then click the Finish button.

Importing the Library

Import the library file provided by the LG MultiScreen SDK package, as described below.

  1. 1. Copy the LGMultiScreenSDK.jar file in the libs folder of the LG Secondary Screen SDK package to apps > libs of the project folder.

    Copy the LGMultiScreenSDK.jar file in the libs folder of the LG Secondary Screen SDK package to apps > libs of the project folder.

  2. 2. Right click the jar file and select “Add as Library”, as shown below.

    Right click the jar file and select “Add as Library”, as shown below.

  3. 3. Add the following import statement at the top of the MainActivity.java file.

    import com.lge.display.DisplayManagerHelper;

    import com.lge.display.DisplayManagerHelper.SwivelStateCallback;

How to determine if the app is running on the LG Wing device

The following feature is provided to check if the device on which the app is running supports the LG MultiScreen library.
Feature name: “com.lge.multiscreen”

The developer must check it with getSystemAvailableFeatures() or hasSystemFeature(String) of PackageManager before using the APIs provided in the LG MultiScreen library. LG Wing device and LG Wing Emulator return true and unsupported devices return false.

private boolean hasLGMultiScreenFeature(){

String feature = "com.lge.multiscreen";

PackageManager pm = getPackageManager();

return pm.hasSystemFeature(feature);

}

Using the LG MultiScreen API

The developer can develop an application for LG Wing using the API provided by the LG MultiScreen library.
Refer to docs > API Reference of the LG MultiScreen SDK package for the detailed information of the API specification.

The LG MultiScreen SDK package provides the following six APIs. The developer can determine the Multi Display support, type, and the display ID using the API and check the callback registration, release, state change of Swivel Mode.
The developer can use the API of the LG MultiScreen SDK package in the following way

1. class DisplayManagerHelper

Method Description
public static boolean isMultiDisplayDevice() Check if the Second Screen or the cover display is supported. Returns
true: Multi display supported
false: Multi display not supported

import com.lge.display.DisplayManagerHelper;

boolean isMultiDisplayDevice = DisplayManagerHelper.isMultiDisplayDevice();

Method Description
public int getMultiDisplayId() Retrieve the display ID of the Second Screen or the cover display.
Returns
Display ID: The display ID of the screen if the Second Screen

import com.lge.display.DisplayManagerHelper;

DisplayManagerHelper displayManagerHelper = new DisplayManagerHelper(mContext);

int displayId = displayManagerHelper.getMultiDisplayId();

Method Description
public static int getMultiDisplayType() Check the type of the multi-display.
Returns
DisplayManagerHelper.TYPE_INVALID
DisplayManagerHelper.TYPE_COVER
DisplayManagerHelper.TYPE_SWIVEL

import com.lge.display.DisplayManagerHelper;

int multiDisplayType = DisplayManagerHelper.getMultiDisplayType()

if (multiDisplayType == DisplayManagerHelper.TYPE_SWIVEL) {

// Second Screen

} else if (multiDisplayType == DisplayManagerHelper.TYPE_COVER) {

// Cover Display

} else {

// Etc

}

Method Description
public void registerSwivelStateCallback
(SwivelStateCallback clbk)
Register the callback to detect the Swivel Mode.

import com.lge.display.DisplayManagerHelper;

import com.lge.display.DisplayManagerHelper.SwivelStateCallback;;

DisplayManagerHelper displayManagerHelper = new DisplayManagerHelper(mContext);

// register callback

MySwivelStateCallback mSwivelStateCallback = new MySwivelStateCallback();

displayManagerHelper.registerSwivelStateCallback(mSwivelStateCallback);

// make callback class

private class MySwivelStateCallback extends SwivelStateCallback {

Method Description
public int getSwivelState() Get current Swivel Mode of device
Returns
DisplayManagerHelper.SWIVEL_NORMAL
DisplayManagerHelper.SWIVEL_SWIVELLING
DisplayManagerHelper.SWIVEL_SWIVELED

import com.lge.display.DisplayManagerHelper;

DisplayManagerHelper mDisplayManagerHelper = new DisplayManagerHelper(mContext);

// get Swivel Mode

int state = mDisplayManagerHelper.getSwivelState();

Caution

The states passed through getSwivelState and SwivelStateCallback are different. The value obtained through getSwivelState is the value of the current Swivel Mode, while the value passed through SwivelStateCallback means that the state is changing.

SWIVEL_NORMAL - SWIVEL_SWIVELLING - SWIVEL_SWIVELLING

Method Description
public void unregisterSwivelStateCallback
(SwivelStateCallback clbk)
Release the registered callback.

import com.lge.display.DisplayManagerHelper;

import com.lge.display.DisplayManagerHelper.SwivelStateCallback;;

DisplayManagerHelper displayManagerHelper = new DisplayManagerHelper(mContext);

MySwivelStateCallback mSwivelStateCallback = new MySwivelStateCallback();

mDisplayManagerHelper.registerSwivelStateCallback(mSwivelStateCallback);

private class MySwivelStateCallback extends SwivelStateCallback {

2. abstract static class DisplayManagerHelper.SwivelStateCallback

The basic actions to be executed in the app according to the Swivel Mode are based on the SWIVEL_END and
NON_SWIVEL_END event rather than SWIVEL_START and NON_SWIVEL_START event.

Method Description
public void onSwivelStateChanged
(int state)
It is called when the callback is registered for the first time and when the Swivel Mode is changed.
Parameter
int state
- DisplayManagerHelper.SWIVEL_START
: swivel started
- DisplayManagerHelper.SWIVEL_END
: swivel ended
- DisplayManagerHelper .NON_SWIVEL_START
: swivel started
- DisplayManagerHelper.NON_SWIVEL_END
: swivel ended

import com.lge.display.DisplayManagerHelper;

import com.lge.display.DisplayManagerHelper.SwivelStateCallback;;

MySwivelStateCallback mSwivelStateCallback = new MySwivelStateCallback();

private class MySwivelStateCallback extends SwivelStateCallback {

@Override

public void onSwivelStateChanged(int state) {

switch(state) {

case DisplayManagerHelper.SWIVEL_START:

// swivel start

break;

case DisplayManagerHelper.SWIVEL_END:

// swivel end

break;

case DisplayManagerHelper.NON_SWIVEL_START:

// Non swivel start

break;

case DisplayManagerHelper.NON_SWIVEL_END:

// Non swivel end

break;

default:

break;

}

}

}

How to get the Display ID of Second Screen using Native API

This section describes how to obtain the display ID of the LG Wing Second Screen using the Android native API instead of the LG MultiScreen SDK API. A LG Wing Second Screen has the device name "Built-in Secondary-Display,” and the developer can retrieve the display ID with the device name of the Second Screen using the native API.

Refer to the following code for details.

import android.hardware.display.DisplayManager;

import android.view.Display;

DisplayManager mDisplayManager;

int mSecondaryDisplayId = 0;

mDisplayManager = (DisplayManager) getApplicationContext().getSystemService

(Context.DISPLAY_SERVICE);

Display[] displays = mDisplayManager.getDisplays();

for (Display d : displays) {

if ("Built-in Secondary-Display".equals(d.getName())) {

mSecondaryDisplayId = d.getDisplayId();

}

}