ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14...

14
Filename Android4TV - Application Development Guide.docx Version v1.00 Classification PUBLIC Status Approved Date May 27, 2014 Author iWedia This document is the intellectual property of iWedia and contains confidential and privileged information. The reproduction, modification, or communication to third parties (or to other than the addressee) of any part of this document is strictly prohibited without the prior written consent from iWedia. ANDROID4TV – Application Development Guide Project: ANDROID4TV

Transcript of ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14...

Page 1: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

Filename Android4TV - Application Development Guide.docx

Version v1.00 Classification PUBLIC

Status Approved Date May 27, 2014

Author iWedia This document is the intellectual property of iWedia and contains confidential and privileged information. The reproduction, modification, or communication to third parties (or to other than the addressee) of any part of this document is strictly prohibited without the prior written consent from iWedia.

ANDROID4TV – Application Development Guide Project: ANDROID4TV

Page 2: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 2/14

SUMMARY

ANDROID ENVIRONMENT SETUP .............................................................................................................. 3

1.1 ADT BUNDLE ................................................................................................................................... 3 1.2 INSTALL THE SDK AND ECLIPSE IDE .................................................................................................. 3 1.3 THE SDK MANAGER .......................................................................................................................... 3

2 DEVELOPMENT OF ANDROID4TV BASED APPLICATIONS ............................................................. 5

2.1 IMPORT ANDROID4TV JAR TO YOUR PROJECT ................................................................................... 5

3 ANDROID4TV SIMULATOR SETUP .................................................................................................... 7

4 APPLICATION DEPLOYMENT ........................................................................................................... 12

5 APPLICATION DEBUGGING ............................................................................................................. 14

Page 3: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 3/14

ANDROID ENVIRONMENT SETUP

The Android SDK provides necessary API libraries and developer tools to build, test and debug Android applications. The system requirements for using the SDK are listed below:

• Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)

• Mac OS X 10.5.8 or later (x86 only)

• Linux (tested on Ubuntu Linux, Lucid Lynx)

o GNU C Library (glibc) 2.7 or later is required

o On Ubuntu Linux, version 8.04 or later is required

o 64-bit distributions must be capable of running 32-bit applications

1.1

In order to get started with Android application development, the ADT Bundle is highly recommended for use. It includes the essential Android SDK components and a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development. The ADT bundle consists of:

ADT BUNDLE

• Eclipse + ADT plugin

• Android SDK Tools

• Android Platform-tools

• Android platform

• Android system image for the emulator

The ADT Bundle can be downloaded from the official Android developer web site at: http://developer.android.com/sdk/index.html

1.2

Unpack the ADT Bundle ZIP file (named adt-bundle-<os_platform>.zip) and save it to an appropriate location, such as a “Development” directory in your home directory. Open the adt-bundle-<os_platform>/eclipse/ directory and launch eclipse.

INSTALL THE SDK AND ECLIPSE IDE

The IDE should already be loaded with the Android Developer Tools plug-in and the SDK ready to go. To provide easier access to the SDK tools from the command line, location of the SDK’s tools/ and platform-tools needs to be added to the PATH environment variable.

1.3

To be able to develop application for various versions of Android platforms, a proper Android SDK version needs to be installed. For that purposes, the SDK Manager should be used. SDK Manager can be launched in one of the following ways:

THE SDK MANAGER

• From Eclipse, select Window > Android SDK Manager.

• On Windows, double-click on the SDK Manager.exe file at the root of the Android SDK directory.

Page 4: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 4/14

On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute android sdk.

You can select which packages you would like to download by toggling the checkboxes on the left, then click Install to install the selected packages.

Figure 1: The Android SDK Manager shows the SDK packages that are available,

already installed, or for which an update is available

In order to support all Android DTV apps, it is recommended to install at least Android 4.0 (API14) target version.

Page 5: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 5/14

2 DEVELOPMENT OF ANDROID4TV BASED APPLICATIONS

The provided ANDROID4TV jar file is a Java library containing necessary classes and interfaces that has to be imported by the client applications to establish communication with the framework and use of a DTV functionality.

It is time to create your first ANDROID4TV application project. The process does NOT differ in any aspect to other Android application development process. Therefore, start the Eclipse IDE and create a new Android application project.

2.1

Once the Android project is created, follow the steps to configure it. First, ANDROID4TV JAR library needs to be included to the project build path. Under the Eclipse settings follow the next steps:

IMPORT ANDROID4TV JAR TO YOUR PROJECT

• Check if libs folder exists in the root of your Android project. If it doesn’t, create a new folder named libs.

• Copy android4tv-framework.jar file to libs folder in case you want to run your application on platform or copy android4tv-framework-simulator.jar to libs folder in case you want to run your application on simulator. Following images will demonstrate use case for android4tv-framework.jar. Your project package structure with libs folder should look like the image below.

Figure 2: Structure of ANDROID4TV project

• Refresh your project by right clicking on the project name and selecting Refresh option.

• Add DTV API JAR file to project build path. Right click on ANDROID4TV-framework.jar file and navigate to Build Path. Select Add to Build Path. The jar file will appear in project Referenced Libraries. The following procedure is shown on image below.

Page 6: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 6/14

Figure 3: Adding ANDROID4TV JAR file to build path and Referenced Libraries

Page 7: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 7/14

3 ANDROID4TV SIMULATOR SETUP

The ANDROID4TV framework can now be tested in a simulated environment, without the actual hardware. In order to run the ANDROID4TV Simulator you will need virtualization software. This document will provide the instructions on how to setup Simulator using the Oracle VM VirtualBox solution on Windows7 OS, although any other VM solution may be suitable for this purpose. Please note that the setup process may slightly differ on other OSs (i.e. OSX, Linux distributions…).

Virtual machine, powered by Android 4.2.2 with pre-integrated ANDROID4TV framework, example applications and testing streams is all packed within the single virtual disk image (vdi).

The newest version of the Simulator’s virtual disk image can be found at:

http://android4tv.iwedia.com/documents/AndroidJB422.zip

while the Oracle VM VirtualBox solution can be downloaded at:

https://www.virtualbox.org/wiki/Downloads

In order to run VirtualBox on your machine, you need:

• Reasonably powerful x86 hardware. Any recent Intel or AMD processor should do.

- Memory. You will need at least 1024 MB of RAM plus the amount that the guest operating system needs. (~2048MB in total)

- Hard disk space. 1GB availabe space on HDD.

- Host operating system. Presently, Windows (XP and later), many Linux distributions, Mac OS X, Solaris and OpenSolaris are supported.

Follow the step by step guide to configure and run the Simulator:

1) Verify the virtualization extensions are enabled in BIOS on your machine. The BIOS settings for Intel VT or AMD-V are usually in the Chipset or Processor menus.

2) Run the Oracle VM Virtual Box

3) Press the New button

Page 8: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 8/14

Figure 4: Oracle VM VirtualBox main window

4) Enter the name of the Virtual Machine (i.e. AndroidVM).

Select:

a. Type: Linux

b. Version: Other Linux

Figure 5: Oracle VM VirtualBox – Create Virtual Machine window

5) Set the memory size to 1024MB or more.

Page 9: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 9/14

Figure 6: Oracle VM VirtualBox – Memory Configuration window

6) Select the option “Use an existing virtual hard drive file”

Figure 7: Oracle VM VirtualBox – Virtual hard drive selection window

7) Select the previously downloaded file

Page 10: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 10/14

Figure 8: Oracle VM VirtualBox – Virtual disk image selection window

8) Set the pointing device

Figure 9: Oracle VM VirtualBox – Main window with the AndroidVM

Figure 10: Oracle VM VirtualBox – Virtual Machine System configuration window

Page 11: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 11/14

9) Set the Network Adapter to work as “Bridged Adapter”

Figure 11: Oracle VM VirtualBox – Virtual Machine Network configuration

10) You should be now ready to start. Run the simulator!

Figure 11: Oracle VM VirtualBox – Main window with the AndroidVM

Page 12: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 12/14

4 APPLICATION DEPLOYMENT

In order to deploy and test the application, you should either have the iWedia ANDROID4TV Simulator or the ANDROID4TV compliant platform. Get the “real feel” experience by becoming our partner. Sign the ESLA and order the STB for evaluation. Additionally, 8h of remote technical support will be at your disposal along with the issue reporting service. Please visit the http://android4tv.iwedia.com/order-platform in order to get more details about the development platform.

ANDROID4TV Simulator as well as ANDROID4TV TV/STB embedded platforms come with already pre-installed ANDROID4TV framework, which exposes DTV functionalities to the application.

The framework API is the same on both targets, therefore the application developed for ANDROID4TV Simulator should run on Android platform without any changes. Moreover, no differences between deployment of applications on Android virtual machine and Android compliant platform are noticed. The process is the same as for any application deployment on Android based devices.

In order to install ANDROID4TV based application you have to connect to the target running Android system image using Android ADB tool:

• At the target side, open the Android All apps menu and select Settings option. Under About menu select Status option. In pop-up dialog IP address should be displayed.

• Follow the ADB application install guide to complete the process: http://developer.android.com/tools/help/adb.html

Limitations of usage of the Android virtual machine compared with the Android compliant platform are described below.

Notice: ANDROID4TV Simulator Limitations

The major difference between the Android virtual machine compared with the Android compliant platform is that virtual machine provides hard-coded data as opposed to a real data from the live transport stream provided by the Android compliant platform. There is no DTV middleware and hardware support to parse live transport stream data and provide actual information to the DTV GUI application, therefore all information as lists of channels, service information, Electronic Program Guide (EPG), channel scan, etc. are hard-coded. Other DTV functionalities like teletext, subtitle, multimedia, personal video recorder (PVR), DTV settings, etc are not supported by the Android virtual machine.

Figure 12: Android IP address

Page 13: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 13/14

• Open command prompt/terminal and type adb connect [Android virtual machine IP address]. If adb command is not found check if the Android SDK is properly installed “1.2. Install the SDK and Eclipse IDE”. If properly installed, and the SDK’s tools/ and platform-tools paths are not added to your PATH environment variable, navigate to the SDK’s platform-tools folder (adt-bundle-<os_platform>/sdk/platform-tools) and repeat adb connect command

• To launch an Android DTV application, mark the Android DTV project in the Package Explorer by clicking on it. Click toolbar option Run and from drop-down menu select Run. Run as dialog shall open. Select Android Application and then click OK button

• Your application should be successfully started

Page 14: ANDROID4TV – Application Development Guide · ANDROID4TV – Application Development Guide 3/14 ANDROID ENVIRONMENT SETUP The Android SDK provides necessary API libraries and developer

ANDROID4TV – Application Development Guide 14/14

5 APPLICATION DEBUGGING

In order to debug the Android DTV apps, you should be using standard Android SDK provided tools.

For detailed instructions take a look at:

http://developer.android.com/tools/debugging/index.html