Skip to Content

How to use device information available in Streamezzo Device Database

Printer-friendly versionSend to friendPDF version
Rookie

This tutorial explains how to take advantage of information brought by Streamezzo for each device. Customers benefit from this information to deploy Rich Media Applications on the heterogeneous range of mobile devices with a centralized and easy-to-maintain application code.

Streamezzo performs qualification tests for each device and provides the results directly in Workbench Developer, such information also being available at runtime in order to adapt the Rich Media Application display and behaviour accordingly (i.e. considering screensize, keypad and/or touchcreen availability and many other decision criteria).

Consulting device information

Device information qualified and collected by Streamezzo is available directly within Workbench Developer, as a database.

This information can be consulted in dedicated views, one can check the characteristics for each device to be targeted by the forecasted Rich Media Application:

  • "Devices" view (on the left) lists all supported devices brands and models
  • Device information view (on the right) displays available device information for the selected device

Updating devices and device information

Workbench Developer comes with a default set of identified devices and related info. At any time it is possible to check if database updates is available on Streamezzo distant repository. Streamezzo devices database can be updated if:

  • New devices are supported
  • Updated device packages are available
  • Device information has been updated or completed

When launching the Devices > Check for updates operation, Workbench Developer will contact Streamezzo Device Packages distant repository and will automatically switch to a dedicated perspective displaying all useful information (the previously mentioned "Devices" view and the "Remote device packages" view listing all updates available on Streamezzo Device Packages distant repository).

Synchronization of your local repository with the distant one can be performed from this dedicated perspective.

Exploiting device information at application runtime

Device information is available for consultation but also at runtime to allow the Rich Media Application adapting to the device characteristics and capabilities (application can be tuned according to the screensize, keypad and/or touchscreen availability, features availability...).

Such information can be ingested in Streamezzo Adaptation Framework (considering each device screensize to adapt the layout) and Streamezzo Components (considering the keypad and/or touchscreen availability to adapt the offered interactions, for example).

To access such information in a very straightforward way, Streamezzo provides the Device API, granting the ability to access this information this way:

The following code sample illustrates how to access the information available in the device database provided by Streamezzo.

The purpose of the code sample is simply to display on screen if the addressed device offers keypad and/or touchscreen inputs, relying on the Device API ; incidentally it will also display the device brand and model, and log on server all available device information.

The corresponding Workbench Developer project is available for download at the bottom of this page.

  1. <%@page import="com.streamezzo.odp.connector.AdaptationTransaction" %>
  2. <%@page import="com.streamezzo.odp.connector.StzConnectorsManager" %>
  3. <%@page import="com.streamezzo.odp.connector.AdaptationConnector" %>
  4.  
  5. <%@page import="com.streamezzo.odp.adaptation.device.Device" %>
  6.  
  7. <Streamezzo>
  8.         <header
  9.                 size="<%=userAgent.getScreenWidth() + " " +  userAgent.getScreenHeight()%>"
  10.                 colorBits="8" lengthBits="16" resolution="2" idBits="16" scaleBits="15"
  11.                 encodingType="0"/>
  12.         <%
  13.                 // Get the connector using the ConnectorManager
  14.                 AdaptationConnector adaptationConnector = StzConnectorsManager.getAdaptationConnector(stzRequest.getService(), 0);
  15.  
  16.                 // Begin a transaction for the current request.
  17.                 AdaptationTransaction tx = null;
  18.  
  19.                 // Device info
  20.                 String brand = "", model = "", inputs = "";
  21.  
  22.                 try {
  23.                         tx = (AdaptationTransaction) adaptationConnector.beginTransaction(stzRequest, null, null);
  24.                         Device device = tx.getDevice();
  25.                         brand = device.getBrand();
  26.                         model = device.getModel();
  27.                         if (device.hasKeypad()) {
  28.                                 inputs += "[keypad]";
  29.                         }
  30.                         if (device.hasTouchscreen()) {
  31.                                 inputs += "[touchscreen]";
  32.                         }
  33.                        
  34.                         stzRequest.getLogger().debug("Device info:"+device.toString());
  35.         %>
  36.         <AUnit>
  37.                 <Insert>
  38.                         <Transform>
  39.                                 <Transform translation="0 20">
  40.                                         <Text string="<%= "Brand: "+brand %>" horizAlign="CENTERED"
  41.                                                 vertAlign="MIDDLE"/>
  42.                                 </Transform>
  43.                                 <Transform translation="0 0">
  44.                                         <Text string="<%= "Model: "+model %>" horizAlign="CENTERED"
  45.                                                 vertAlign="MIDDLE"/>
  46.                                 </Transform>
  47.                                 <Transform translation="0 -40">
  48.                                         <Text string="<%= "Inputs: "+inputs %>"
  49.                                                 horizAlign="CENTERED" vertAlign="MIDDLE"/>
  50.                                 </Transform>
  51.                         </Transform>
  52.                 </Insert>
  53.         </AUnit>
  54.         <%
  55.                 } finally {
  56.                         if (tx != null) {
  57.                                 tx.endTransaction();
  58.                         }
  59.                 }
  60.         %>
  61. </Streamezzo>

Profiling application emulation

Finally, prior to observing how the Rich Media Application adapts to the real devices relying on such device information brought by Streamezzo, the application developer is able to first check the Rich Media Application using the provided emulator (use Service > Emulate Service).

When launching the application emulation the simulated device can be selected so the emulator will act as being the selected device. Device information is indeed used by the emulator: it will be displayed with the same characteristics (screensize) and considering it has the same capabilities (e.g. supported features).

 

Device information provided by Streamezzo and available for consultation and runtime adaptation is a significant added-value feature, enabling to take advantage of such information at all stages of the Rich Media Application realization cycle:

  • During conception, it will be useful to identify if the targeted devices are compliant with the Rich Media Application requirements
  • During implementation, it will be accessed at runtime and ingested to adapt the Rich Media Application accordingly
AttachmentSize
Device_database.swz1.27 MB