Saturday, February 28, 2009

What Is - The file size limit for wireless downloads


The maximum size of a COD file, which can be downloaded wirelessly, varies based on a number of factors. These factors include the BlackBerry Device Software version, the BlackBerry Enterprise Server™ version, the BlackBerry JDE version, and the type of browser used to install the application (for example, BlackBerry Browser connected to a BlackBerry MDS or BlackBerry Mobile Data Service, or Internet Browser using the BlackBerry Internet Service™).

Using BlackBerry JDE 3.6 and 3.7

When using BlackBerry JDE 3.6 and 3.7, the maximum COD file size that can be downloaded wirelessly, using a browser, is 128 KB. This number includes a maximum limit of 64 KB for application data (code) and 64 KB for resource data (images or files).

Note: Each section must also be under the 64 KB limit; therefore, you cannot complete a wireless installation of a COD file that contains 20 KB of application data and 100 KB of resource data. There are no exceptions to this limit for applications built with BlackBerry JDE 3.6 and 3.7.

To work around this, build your application so that it consists of several smaller COD files. Place some of your object code or resources into a Library project. When built, this will produce multiple COD files that must be smaller than the limit.

To build a Library project, complete the following steps:

  1. In the BlackBerry JDE, create a second project.
  2. Right-click the project and select Properties.
  3. On the Application tab, select Library as the Project Type.
  4. Move some of your classes or resources from the main application into this library project to reduce the size of your main application.

The library project becomes part of the runtime classes on the BlackBerry device.

  1. In the main application, import this package to be able to use the classes.
  2. Compile both applications.

You now see two distinct COD files (one for your application, and one for the library).

  1. Change your JAD file to allow the user to download the two COD files, as shown below:

....
RIM-COD-URL: myLibrary.cod
RIM-COD-URL-1: myApp.cod
RIM-COD-SHA1: 65 39 3f 54 d8 ef 6e 43 72 37 db 5e 7a 27 89 84 f8 e0 30 9b
RIM-COD-SHA1-1: 88 02 c3 1c 00 19 e8 bb e5 1a 3f f8 28 8e b5 57 5b dd 48 14
RIM-COD-Size: 33128
RIM-COD-Size-1: 46996
...

Note: Always place the libraries at the top of the JAD list so they are downloaded first.

Using BlackBerry JDE 4.0 and Later

BlackBerry JDE 4.0 introduced the concept of sibling COD files. If an application is too large to fit within the 128 KB limit (64 KB of application data and 64 KB of resource data), sibling COD files are created and packaged into a single main COD file. Sibling COD files are a series of COD files that are suffixed with -#, where # is incremented for each sibling COD file. These sibling COD files are then packaged into a main COD file that has a basic ZIP structure. The sibling COD files adhere to the 128 KB (64 KB + 64 KB) size limit. To determine if your application contains sibling COD files, you can attempt to open the COD file with WinZip®. If the COD file contains sibling COD files, you can open it and View or Extract the sibling COD files in the same way as a ZIP file.

Using the BlackBerry Browser to Install

When using a BlackBerry Device Software or a BlackBerry Enterprise Server earlier than 4.0, the maximum COD file size that can be downloaded wirelessly, using a browser, is 128 KB (64 KB of application data and 64 KB of resource data).

BlackBerry MDS or BlackBerry Mobile Data Service 4.0 and later paired with a device running BlackBerry Device Software 3.8 or later is able to download a COD file greater than 128 KB that contains sibling COD files.

Note: If the COD file does not contain sibling COD files, the limit is still 128 KB. BlackBerry MDS or BlackBerry Mobile Data Service can extract the sibling COD files from the main COD file, and send them individually to the BlackBerry Browser.

Using the Internet Browser to Install

When using the Internet Browser through the BlackBerry Internet Service, the maximum COD file size that can be installed wirelessly is 128 KB (64 KB of application data and 64 KB of resource data). The Internet Browser does not have the ability to install a COD file that contains sibling COD files, regardless of their size.

To support this browser, the sibling COD files should be extracted from the main COD file and placed individually on a web server. To extract them, use WinZip. Make sure you extract the sibling COD files to a different directory other than the location of the main COD file as the first sibling COD file will have the same name as the main COD file.

After the COD files have been extracted, reference each of them in the JAD file. Use the example above to update the JAD file.

Note: BlackBerry JDE 4.1 and later will automatically create a JAD file that references all sibling COD files, thus, no editing of the JAD file is needed.

Optimized installation

It is recommended that sibling COD files be extracted from the main COD file and placed individually on a web server instead of packaged in the main COD file. This allows both the BlackBerry Browser and Internet Browser to install the application. It is also more efficient for the web server. The BlackBerry Enterprise Server does not store COD files, so every time a sibling COD file that is packaged in a main COD file is requested by a device, the BlackBerry MDS or BlackBerry Mobile Data Service must download the entire main COD file to extract the single requested sibling COD file. As a result, the BlackBerry MDS or BlackBerry Mobile Data Service will download a main COD file multiple times (one time for every sibling COD file it contains).

No comments:

Post a Comment

Place your comments here...