Skip to Content

How to create a Client Package for Android

Printer-friendly versionSend to friendPDF version
Intermediate

This tutorial details how to create a client package for an Android device using Streamezzo Workbench Developer, i.e. the provided client package creation wizard and the androidPackage Ant task.

Pre-requisites

You must install Streamezzo Android Mobile Package Creator (AMPC) application in order to support the creation fo client packages for Android devices in Streamezzo Workbench Developer.
See Android Mobile Package Creator Tutorial for its specific pre-requisites (especially note the default JRE must be in version 1.6 or higher).

Using the client package creation wizard

Creating the example service

After AMPC installation, go to Workbench Developer to create a new Service "MyFirstAndroidApplication" with a single client scene (welcome.rsp).

welcome.rsp source code:

  1. <Streamezzo>
  2.         <header size="<%= userAgent.getScreenWidth()+" "+userAgent.getScreenHeight() %>" colorBits="8" lengthBits="16" resolution="2"
  3.                                         idBits="16" scaleBits="15" encodingType="0" />
  4.         <AUnit time="0">
  5.                 <Background color="1.0 1.0 1.0"/>
  6.                 <Insert>
  7.                         <Text string="Welcome to Android Platform" horizAlign="CENTERED" vertAlign="MIDDLE" size="MEDIUM" style="BOLD" />
  8.                 </Insert>
  9.         </AUnit>
  10. </Streamezzo>


You can now create your client package using the wizard available from menu Service > Create Client Package. You then just have to follow the steps and the client package will be created in the specified folder.

Defining a client package creation ANT task

In Window > Show View > Other..., select Ant > Ant view.

In the Service Browser, create a new folder "ant" and add a new ANT file "build.xml" (from the Service Desk contextual menu select New > Other... > New ANT build file).

In this file, add the source code below then edit it (especially paths).
You can also rely on the previously used wizard to generate the Ant tasks: right-click in the "build.xml" file editor and select Wizards > Create client package target.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="project" default="default">
  3.        
  4.         <target name="default">
  5.                 <stz.client.package jdk="C:/jdk1.5.0_20" start="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/src/welcome.rsp">
  6.                         <serviceParameters>
  7.                                 <serviceParameter name="adaptation.content.source" value="res/adaptation.xml" />
  8.                         </serviceParameters>
  9.                         <scenes>
  10.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/src" includes="welcome.rsp" />
  11.                         </scenes>
  12.                         <resources>
  13.                                 <dirset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication" includes="res" />
  14.                         </resources>
  15.                         <compilationLibraries>
  16.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="adaptation.jar" />
  17.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="com.streamezzo.odp.utils.jar" />
  18.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="dom4j-1.6.1.jar" />
  19.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="jaxen-1.1.1.jar" />
  20.                         </compilationLibraries>
  21.                         <runtimeLibraries>
  22.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="adaptation.jar" />
  23.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="com.streamezzo.odp.utils.jar" />
  24.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="dom4j-1.6.1.jar" />
  25.                                 <fileset dir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication/Components" includes="jaxen-1.1.1.jar" />
  26.                         </runtimeLibraries>
  27.                         <packages>
  28.                                 <androidPackage packageId="android_dalvik_htc_g1" packageVersion="6.02.08-6.0.1" outputDir="C:/Documents and Settings/user/Mes documents/MyFirstAndroidApplication">
  29.                                         <device brand="HTC" model="G1" packageID="android_dalvik_htc_g1" version="6.02.08-6.0.1" />
  30.                                 </androidPackage>
  31.                         </packages>
  32.                 </stz.client.package>
  33.         </target>
  34.  
  35. </project>
  36.      


Take care of setting:
  • the property android.package value attribute to the path to the appropriate AMPC device package ZIP file
  • stz.client.package jdk attribute to the path to your JDK folder
Drag and drop build.xml file from the Service Desk to the Ant view and just click on "Run" button to launch the Android device package ANT task (building the client package for your device will take a few seconds).






If an Android device is currently connected, the deployment on Android platform is automatically proposed at the end of the build process.
After deployment, just click on the "RichMedia" icon to launch the application.