Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Testing and Deployment

Create a single .alx file to install multiple versions of an application

by BlackBerry Development Advisor ‎02-16-2010 02:51 PM - edited ‎02-18-2010 10:36 AM (11,914 Views)

Summary


This article applies to the following:

  • BlackBerry® smartphones


Description


As applications are updated with new application programming interfaces (APIs) that are added to the BlackBerry API set, applications may not be compatible with older versions of the BlackBerry® Device Software. It is possible to define multiple versions of an application in a single .alx file by specifying different .cod files to be loaded depending on the BlackBerry Device Software version, BlackBerry smartphone series, vendor, or availability of functionality such as a camera or a built-in Global Positioning System (GPS) receiver. Versioning is accomplished using the directory tag and attributes such as _blackberryVersion, _platformVersion, series, _vendorID, and GPS. The _blackberryVersion attribute refers to the version of the BlackBerry Device Software, and the _platformVersion attribute refers to the platform version. The series attribute refers to the BlackBerry smartphone series (for example, the BlackBerry® 8800 smartphone and the BlackBerry® 8820 smartphone both belong to the BlackBerry® 8800 Series), the GPS attribute indicates whether the BlackBerry smartphone has a built-in GPS receiver, and the _vendorID attribute refers to the wireless service provider branding of the BlackBerry smartphone. The benefit of this approach is that all BlackBerry smartphone users can use a single .alx file to install different versions of the same application, allowing the application to be specialized or generic.


The following examples show how to take advantage of these attributes in an .alx file.


Example 1a: How to install different application versions based on the BlackBerry Device Software version



<loader version="5.1">
<application id="HelloWorld">
<name>HelloWorld</name>
<description>Hello World installer test</description>
<version>1.0</version>
<vendor>RIM</vendor>
<copyright>Copyright (c) 2007 RIM</copyright>
<fileset Java="1.34" _blackberryVersion="[4.1.0,4.2.3)">
<directory>410_423</directory>
<files>HelloWorld.cod</files>
</fileset>
<fileset Java="1.34" _blackberryVersion="(4.3.0,4.3.1]">
<directory>430_431</directory>
<files>HelloWorld.cod</files>
</fileset>
</application>
</loader>




This .alx file loads the HelloWorld.cod file on the BlackBerry smartphone. Each <fileset> tag represents the .cod files to install according to the attributes of that <fileset> tag. The <directory> tag contains the relative path of the <files> tag to the path of the .alx file. In the example code, there are two <fileset> tags with different attribute values. The first <fileset> tag is triggered when the BlackBerry Device Software version is greater than or equal to 4.1.0 and less than 4.2.3. The second <fileset> tag is triggered when the BlackBerry Device Software version is greater than 4.3.0 and less than or equal to 4.3.1.


This .alx file points to two different copies of the HelloWorld.cod file, such that the folder structure would look like the following:


.\myAlx.alx
.\410_423\HelloWorld.cod
.\430_431\HelloWorld.cod



Example 1b: How to install different application versions based on the BlackBerry Device Software version and build or revision number



<loader version="5.1">
<application id="HelloWorld">
<name>HelloWorld</name>
<description>Hello World installer test</description>
<version>1.0</version>
<vendor>RIM</vendor>
<copyright>Copyright (c) 2007 RIM</copyright>
<fileset Java="1.34" _blackberryVersion="(4.2.2.171,4.2.2.176]">
<directory>422171_422176</directory>
<files>HelloWorld.cod</files>
</fileset>
<fileset Java="1.34" _blackberryVersion="[4.2.2.170,4.2.2.171)">
<directory>422170_422171</directory>
<files>HelloWorld.cod</files>
</fileset>
</application>
</loader




This .alx file loads the HelloWorld.cod file on the BlackBerry smartphone. Each <fileset> tag represents the .cod files to install according to the attributes of that <fileset> tag. The <directory> tag contains the relative path of the <files> tag to the path of the .alx file. In the example code, there are two <fileset> tags with different attribute values. The first <fileset> tag is triggered when the BlackBerry Device Software version is greater than 4.2.2.171 and less than or equal to 4.2.2.176. The second <fileset> tag is triggered when the BlackBerry Device Software version is greater than or equal to 4.2.2.170 and less than 4.2.2.171 .This .alx file points to two different copies of the HelloWorld.cod file, such that the folder structure would look like the following:



.\myAlx.alx
.\422171_422176\HelloWorld.cod
.\422170_422171\HelloWorld.cod




Example 2: How to install different application versions based on BlackBerry smartphone series and GPS functionality



<loader version="5.1">
<application id="HelloWorld">
<name>HelloWorld</name>
<description>Hello World installer test</description>
<version>1.0</version>
<vendor>RIM</vendor>
<copyright>Copyright (c) 2007 RIM</copyright>
<fileset Java="1.34" series="8100" GPS="True">
<directory>8110_8130</directory>
<files>HelloWorld.cod</files>
</fileset>
<fileset Java="1.34" series="8100" GPS="False">
<directory>8100</directory>
<files>HelloWorld.cod</files>
</fileset>
</application>
</loader>




In this example, there are two <fileset> tags with different attribute values. The first <fileset> tag is triggered when the BlackBerry smartphone belongs to the BlackBerry® 8100 Series and it has a built-in GPS receiver (for example, the BlackBerry® Pearl™ 8110 smartphone). The second <fileset> tag is triggered when the BlackBerry smartphone belongs to the BlackBerry 8100 Series and it does not have a built-in GPS receiver (for example, the BlackBerry® Pearl™ 8100 smartphone).


This .alx file points to two different copies of the HelloWorld.cod file, such that the folder structure would look like the following:



.\myAlx.alx
.\8110_8130\HelloWorld.cod
.\8100\HelloWorld.cod




Example 3: How to install different application versions based on wireless service provider



<loader version="5.1">
<application id="HelloWorld">
<name>HelloWorld </name>
<description>Hello World installer test</description>
<version>1.0</version>
<vendor>RIM</vendor>
<copyright>Copyright (c) 2007 RIM</copyright>
<fileset Java="1.34" series="8300" _vendorID="100" >
<directory>8300_tmo</directory>
<files>HelloWorld.cod</files>
</fileset>
<fileset Java="1.34" series="8300" _vendorID="102" >
<directory>8300_att</directory>
<files>HelloWorld.cod</files>
</fileset>
</application>
</loader>




Example 3 shows how to install different versions of an application based on the wireless service provider. The _vendorID attribute is used to accomplish this task. The value for _vendorID comes from the decimal conversion of the hex number defined in vendor.xml. For example, 100 is 0x64, which is T-Mobile® US in vendor.xml, and 102 is 0x66, which is AT&T® in vendor.xml. Note that in this case, vendor.xml must be present and its contents populated for this to work. The first <fileset> tag is triggered when the BlackBerry smartphone belongs to the BlackBerry® 8300 Series and its wireless service provider is T-Mobile US. The second <fileset> tag is triggered when the BlackBerry smartphone belongs to the BlackBerry 8300 Series and its wireless service provider is AT&T.


This .alx file points to two different copies of the HelloWorld.cod file, such that the folder structure would look like the following:



.\myAlx.alx
.\8300_tmo\HelloWorld.cod
.\8300_att|HelloWorld.cod



Use the following rules to specify a range:

  • Square brackets [ ] indicate inclusive (closed) range matching
  • Round brackets ( ) indicate exclusive (open) range matching
  • Missing lower value implies 0
  • Missing upper value implies infinity

For example, [4.0,) indicates any version greater than 4.0.


You can load an application with this configuration using the application loader tool in the BlackBerry® Desktop Manager or the application push feature of the BlackBerry® Enterprise Server.


Note: To view the BlackBerry Device Software version or the BlackBerry smartphone platform version, on the BlackBerry smartphone, click Options > About or Settings > About.


Note: There are other attributes not listed in this article that can be specified in the <fileset> tag. Any of the attributes defined in the <os> tags of Device.xml can be used in the <fileset> tag of the .alx file. In a typical BlackBerry Desktop Manager installation, Device.xml can be found in the following folder: C:\Program Files\Common Files\Research In Motion\AppLoader.

Contributors
Users Online
Currently online: 25 members 1,639 guests
Please welcome our newest community members: