Custom Vice Screen Display App

              Development Descriptions for Customized Customer Display Program

Content update

2018-01-15

 

•        Remove the common method, descriptions of the key class

•        Update Demo source code

•        Update the method of the development debugging of double screen App

                                                                                                                                                                                                                        


One. Introduction

T1 double screen device has three combinations: host, host + 7 inch second screen, host + 14 inch second screen. Both main & second screen run SUNMI OS customized system, and realize the communication via Sunmi’s encapsulated interface. Main screen is mainly used to run business App, for example: cashier system. Second screen is mainly used for customer display settlement, advertisement content.

Double screen communication principle:

7304985152216485

From the bottom up in turn:

• Driver: this layer is a communication protocol at the bottom layer, the developers do not need to care about it.

• Service: this layer is a communication service encapsulated by Sunmi, the developers also do not need to care about it.

• SDK: this layer is the communication interface used by T1’s self-contained second display program, and the customized customer display program invokes the interface of this layer.

• App: indicating the business app and built-in second display program owned by the developer himself/herself.

 

There are two methods available for the developers to realize second screen display:

• T1 second screen system has its built-in second screen display App by default, and also several built-in commonly used templates. The developer only need to send data with correct format to the second screen via Sunmi’s SDK, and then the second screen’s content display will be realized.

• To develop his/her own second screen display App, it is required to handle by oneself the actions of data receive & send, content display, etc.

 

Although Sunmi’s encapsulated built-in customer display program can meet the usage demands of the

vast majority of developers, yet considering the business diversity, Sunmi adheres to the opening principle, and supports the second screen display customized by the developer himself/herself.

The following text is going to explain the development of customized double screen App.

Two. How to debug App

Since main & second screen communicate via USB, when USB line is plugged in main/second screen, the connection of main & second screen will be disconnected, leading to the impossibility to debug the device. The solution provided by Sunmi is: place the computer to be developed and T1 host to be debugged into the same LAN environment, and carry out the debugging of the device via network.

How to debug

1. Enable USB debug, and the debugging permission:

operation instructions:debug the
device

2. Carry out ADB debug to the device via network:

operation instructions: debugging description

Three. How to develop customized double screen App

(It is emphasized: Sunmi OS is customized based on Android 6.0, it is required by Android 6.0+ that partial sensitive permissions need to have dynamic application)

1. Initialization of the configuration

How to realize customized double screen App will be explained as follows based on Demo.

Step 1:

   Download DoubleApp resource file. (the source code will be compiled with AndroidStudio)

step 2:

   Refer to Demo source code, and declare the following code directly in build.gradle file under app module of Android Studio.

compile 'com.sunmi:DS_Lib:1.0.9'      //Commercial library provides lib, contains the interface has been packaged
compile 'com.google.code.gson:gson:2.6.2'  //gson any version

step 3:

  Register broadcast under the node of the list file AndroidManifest.xml (the developer may refer to the source code to realize the broadcast class by himself/herself).

"...Broadcasting...">  //Receive data broadcast

"com.sunmi.hcservice"/>
"com.sunmi.hcservice.status"/>

step 4:

  Initialize SDK code at the appropriate location, you may refer to Demo source code.

private void initSdk() {
mDSKernel = DSKernel.newInstance();  
mDSKernel.init(this, mIConnectionCallback);  //Bind the service callback
mDSKernel.addReceiveCallback(mIReceiveCallback);  //Dual-screen communications receive data callback
}

2. Develop double screen App

Refer to Demo source code to realize the interaction of double screen data. Its concrete method can be defined by oneself, and we are not going to provide an example here.

When the business logic of main screen and second screen have all been realized, it is required to combine the business codes of main screen and second screen into one apk (since the installation logic of App market is to respectively install one App onto main & second screen, only one APK is required to be submitted as for double screen App).

Four. Preparations before the release of App

The customized double screen App has well been developed, and then this App is going to be released to Sunmi App market for distribution. Before this action, it is required to complete one important step, that is to enable the App market to recognize that this App is double screen App.

Add one line of identification code to AndroidManifest.xml of the App, thus this App will be displayed as double screen App on the App market. In the installation, the App market will install this App respectively onto main screen and second screen.



"sunmi_dual" android:value="open"/>