Sample App Overview

The LG QPair SDK provides sample applications which use the LG QPair APIs for starting an activity or a service on a peer device. In this chapter, the functions of sample applications are described. You can also see how to import sample applications to your work space.

Introduction to Sample Applications

There are three sample applications in the LG QPair SDK. The first two samples are simple examples showing how to start an activity on a peer device. These samples will give you guidance on how to apply LG QPair in your application. The last sample shows not only starting an activity on a peer device but also starting services and optional operations. The sample includes almost all QPair APIs. You can refer to the sample depending on what you need for your application.

 

Start Gallery on Peer

This sample application invokes the gallery application on the peer device. This sample application is a simple application using QPair APIs. The sample application does not require installation of applications on the peer device. When you first load the sample application, you will see Figure 1. The sample application has a button to invoke the gallery application on the peer device as shown in Figure 2.

 

Figure 1 Start Gallery on Peer Screen

Figure 2 Screen on peer device

 

The sample application has only one activity and one button. The sample application UI is described below:

 

Open Gallery Button: This invokes the gallery application on the peer device.

 

Start Custom Activity on Peer

This sample application shows the basic use of QPair APIs. The sample application requires the same sample application to be installed on the peer device. The sample application connects with the QPair service and invokes the same activity on the peer device. When you run the sample application, you will see Figure 3.

 

Figure 3 Start Custom Activity on Peer Screen

 

The sample application has one activity and one button. Here is a description of the sample application UI:

 

Start Custom Activity Button: This invokes the sample application installed on the peer device.

 

QPair API Demo

The QPair API Demo shows how to use properties for the QPair and use QPair APIs such as starting services and sending a peer intent with extra data.

 

Figure 4 shows the sample application screen. The sample application includes buttons to request operations on the peer device that are starting activity and service on the peer device and sending a broadcast intent to the peer device. The sample application also provides text fields for peer intent data for a Peer Intent such as the name and the category of the action. By setting peer intent data, you can specify the action that will be performed on the peer device. In addition, you can attach data to the peer intent and send it to the peer device. Various data types including Boolean, char and float can be attached.

Figure 4 QPair API Demo Screen

 

The sample application shows the received peer intent information if you set the component from the spinner. There are three items shown on the spinner:com.lge.p2p/com.lge.p2pclients.sample.PeerSideActivity;PeerSideReceiver;PeerSideService.These components are included in the sample client installed on your device. When you choose a component from the spinner, you will see Figure 5 on the peer device. The QPair application on the peer device will show the received peer intent information and the extended data.

 

Figure 5 Starting the QPair API Demo on the peer device

 

Below is a list of QPair API Demo UIs:

 

Start Activity Button: This invokes an activity on the peer device.

Send Broadcast Button: This sends a broadcast intent to peer

Start Service Button: This starts a service on peer

Action: This gets a name of the action

Category: This gets a category of the action

Data: This gets an MIME data type

Package: This gets a name of the package handles the action on peer

 

Navigation