0% found this document useful (0 votes)
35 views15 pages

ADS Development Guide Smart

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 15

ADS

DEVELOPMENT
GUIDE

ADS-SMART-TEAM

Revision1.0

2018-7-10

Shenzhen Xinguodu Technology Co.,LtdPublished

www.nexgo.cn
ADS DEVELOPMENT GUIDE

Content

CONTENT ................................................................................................................................................................ 2

REVISION HISTORY ............................................................................................................................................ 3

SCOPE ....................................................................................................................................................................... 4

GUIDE CONVENTIONS .................................................................................................................................................... 4

GETTING STARTED ............................................................................................................................................ 5

DIFFERENCE BETWEEN DEBUG AND RELEASE ..................................................................................................... 5

1 ENVIRONMENT ............................................................................................................................................. 5

1.1 IDE ...................................................................................................................................................................... 5

1.2 IMPORT NEXGO SDK ...................................................................................................................................... 6

2 DEBUGGING ................................................................................................................................................... 7

2.1 ENABLE USB DEBUGGING ............................................................................................................................... 7

2.2 USING ADB DEBUGGING .................................................................................................................................. 8

2.3 DEBUGGING IN APP ........................................................................................................................................... 8

3 RUNNING SAMPLE APPLICATION ....................................................................................................... 9

4 APK SIGNATURE .........................................................................................................................................10

4.1 APPLY FOR SECURITY SYSTEM ACCOUNT AND CERTIFICATE .................................................................... 10

4.2 SIGN APK ON SECURITY SYSTEM.................................................................................................................. 11

4.3 APK SIGNATURE FAILED? .............................................................................................................................. 11

5 CERTIFICATE INSTALLATION ..............................................................................................................12

6 APK INSTALLATION ..................................................................................................................................14

2
ADS DEVELOPMENT GUIDE

6.1 INSTALL APK ON DEBUG DEVICE ............................................................................................................... 14

6.2 INSTALL APK ON RELEASE DEVICE ........................................................................................................... 14

Revision History

Date Version Description Author


2018-7-10 V1.00 1. First Draft Brad Hong

2019-01-03 V1.01 Change Import NEXGO SDK Hassan

3
ADS DEVELOPMENT GUIDE

Scope
The purpose of this document is to provide a quick start for Android developers to build the

Application Development Environment (ADE) and run an application on the POS terminal with

XGD-ADS (Application Development Suit of NEXGO).

The XGD-ADS (Application Development Suit of NEXGO) includes the following resource, all

available on the FTP server ftp://123.58.32.120:8490, or ftp://207.226.217.203:8490

 API Reference / Documents (Obtained from “…/SDK_vx_xx/docs/ ”)

 Packages of SDK library (Java Archive, Native Library …)

 Sample Code (NEXGO-SDK-based)

Guide Conventions

Various conventions are used to help you quickly identify special formatting. Table 1 describes these
conventions and provides examples of their usage.

Convention Meaning Example


See Guide Conventions.
Text in blue indicates terms that are
Blue
cross referenced, or to provide an URL.
http://www.nexgo.cn
《ADS DEVELOPMENT GUIDE》
Bold typeface indicates books, folders,
Bold
functions, parameters or emphasis.
manage.so
Courier typeface indicates console
Courier [root@localhost~]$ ./MakeCore -h
commands, or contents of source code.

The pencil icon is used to highlight


important information.

Attention: The attention symbol is used as a


warning when wrong operation might
occur.

Table 1

4
ADS DEVELOPMENT GUIDE

Getting Started

Before starting a project based on NEXGO SDK, make sure you are
using the DEBUG mode device to develop.

For the sake of security, the APKs are not allowed to be installed and run on the POS terminal
with RELEASE mode before being signed correctly. Generally, if a project is at development
period, we suggest you ask NEXGO for a DEBUG mode device, which will help you to simplify
the development.

Difference between DEBUG and RELEASE

The DEBUG mode device will accept any APK without signature. That is, the DEBUG mode
device allows developers to do anything like other Android devices. Meanwhile, it cannot be
used in production because of its insecurity.

The RELEASE mode device will only accept the APKs which are signed correctly. The
signature certificate is authorized by NEXGO, for more details, referring to Chapter 4. APK
Signature, Chapter 5. Certificate Installation and Chapter 6. APK installation. Only
RELEASE mode devices can be used in production.

1 Environment

1.1 IDE

It is strongly recommended to use Android Studio with the version bigger than 2.2.0. By
checking here to download the latest Android Studio.

5
ADS DEVELOPMENT GUIDE

1.2 Import NEXGO SDK

a) Copy the SDK libraries(…/SDK_vx_xx/Library/) to your project …/app/libs/


For example:

b) Set minSdkVersion in your app projects build.gradle file


defaultConfig {
applicationId "com.nexgo.apiv3demo"
minSdkVersion 21 //Android 5.0
targetSdkVersion 26
versionCode 1
versionName "1.0"
}

c) Add NEXGO Library to your app projects build.gradle file

dependencies{

complie(name: 'nexgo-smartpos-sdk-vx.x.x', ext: 'aar')

d) Set directory of JniLibs in your app projects build.gradle file


sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}

6
ADS DEVELOPMENT GUIDE

e) Synchronize projects with Gradle files.

It is recommended to set the minSdkVersion bigger than 21 to get a


better performance as the Android version of NEXGO smart POS is
Android 5.1.

2 Debugging

NEXGO smart POS uses the standard USB cable to connect PC, which is same as most of
Android phones.

2.1 Enable USB Debugging

Following the steps to enable USB Debugging:

a) Go to Settings from launcher.

b) Find Developer options in the column of System.

c) Turn on the switch of Developer Settings.

d) Turn on the switch of USB Debugging in the column of Debugging.

7
ADS DEVELOPMENT GUIDE

2.2 Using ADB Debugging

NEXGO smart POS supports ADB debugging, which is same as universal Android devices.
Install universal ADB driver by checking here.

2.3 Debugging in App

Use the debugging program from Android Studio. By checking the official web site of
Android Studio to start debugging.

8
ADS DEVELOPMENT GUIDE

3 Running Sample Application

Running sample application is same as running the project downloaded from


GitHub by using Android Studio.

Following the steps to run sample application:

Step 1 Open Android Studio.

Step 2 Open the project named as SampleCode-x.x.x downloaded from FTP.

Step 3 Run App(Shift + F10).

By reading the source code of project SampleCode-x.x.x to understand how to use NEXGO SDK
API to develop.

9
ADS DEVELOPMENT GUIDE

4 APK Signature

An online system named as Security system is used by NEXGO to sign APKs for the smart POS
using the NEXGO’s signature strategy.

……………………………………………………………………………………………………….……………

Attention: All the description about signature mentioned in this document is NOT the
standard APK signature which is carried out by Google. A separate signature strategy
is used by NEXGO to prevent installing other APKs which are not signed correctly.
NEXGO’s signature strategy is totally separate from the standard APK signature. That is, if
you are trying to install an APK on NEXGO’s RELEASE mode device, make sure it should
have both standard signature and NEXGO’s signature.

The APK signature mentioned in this document is NEXGO’s signature.

……………………………………………………………………………………………………………..………

If you are using RELEASE mode device, the signature is


mandatory, otherwise the APK installation will be rejected. On the
other hand, if you are using DEBUG mode device, just ignore the
Chapter 4, Chapter 5, and Chapter 6.

4.1 Apply for Security System Account and Certificate

Security system is used to managing the important private operations such as signature,
switching device mode. All the operations will be safe by using this system.

Security system account allows users to log in the NEXGO system. In general, the
administrator will only authorize the permission for the users to sign APK by using the
corresponding certificate.
10
ADS DEVELOPMENT GUIDE

The certificate provided by NEXGO is customized for different customers, and it should be
installed to the terminal, which will verify the legality of the APK’s signature. That is, only
the signed APK by the corresponding certificate can be installed to the RELEASE mode
devices. To understand how to install certificate, refer to the Chapter 5. Certificate
Installation.

To apply for the Security system account and certificate, some information is required to help
us customizing for users.
 The complete name of your company.
 The abbreviated name of your company.
 Your name and E-mail address.
For example:
Shenzhen Xinguodu Technology Co., Ltd.
NEXGO
Brad Hong, xxxxxxxxx@xgd.com

Send the information as the example above to the business man by e-mail and we will feed
back the Security system account and certificate.

4.2 Sign APK on Security System

Please follow “Nexgo Security System.pdf” to sign APK.

4.3 APK Signature Failed?

 Check if the filename ends with .apk.


 Try to simplify the filename, for example: app.apk.
Generally, the filename should not be greater than 16 characters and should not use the
special character such as ‘.’, ‘/’, ‘(’, ‘_’ .etc.
 If it’s still working, check the signature result and contact us for support.

11
ADS DEVELOPMENT GUIDE

5 Certificate Installation

Follow the steps to install certificate:

Step 1. Connect PC and POS terminal by the USB cable. The PC will recognize it and could have
access to the internal storage of POS terminal.

Step 2. Copy the certificate file(xgd_cert.zip) to the internal storage of POS terminal.

Step 3. Find the certificate file (xgd_cert.zip) on POS terminal by the following steps:
Setting---Security---SmartPOS Trusted credentials---ADD CERTIFICATE---sdcard

Step 4. Click the certificate file (xgd_cert.zip) to load and check the certificate information.

Step 5. Check the loaded certificate information by the following steps


Setting---Security---SmartPOS Trusted credentials

The screenshots of the operations on POS terminal are shown as below:

12
ADS DEVELOPMENT GUIDE

13
ADS DEVELOPMENT GUIDE

6 APK Installation

6.1 Install APK on DEBUG device

The APKs without signature are allowed to be installed on DEBUG mode


devices.

Install APK locally


Step 1. Connect PC and POS terminal by the USB cable. The PC will recognize it and could have
access to the internal storage of POS terminal.

Step 2. Copy the APK to the internal storage of POS terminal.

Step 3. Select File Manager on POS terminal, and find the APK file, then click it to install.

Install APK through Android Studio


Step 1. Connect PC and POS terminal by the USB cable.

Step 2. Using Android Studio to install APK directly, which is same as standard Android
development.

6.2 Install APK on RELEASE device

Attention: The APKs without signature are NOT allowed to be installed on


RELEASE mode devices. It is also not supported to install APK directly
through Android Studio because of the signature verification.

Install APK locally

14
ADS DEVELOPMENT GUIDE

Step 1. Connect PC and POS terminal by the USB cable. The PC will recognize it and could have
access to the internal storage of POS terminal.

Step 2. Copy the APK to the internal storage of POS terminal.

Step 3. Select File Manager on POS terminal, and find the APK file, then click it to install.

15

You might also like