`
wuhua
  • 浏览: 2111778 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

How To - Programmatically read the attributes of a JAD file

阅读更多

Summary

This article applies to the following:

  • BlackBerry® Device Software 4.3 and later
  • BlackBerry smartphone

Details

When publishing an application over the wireless network, the application developer may need to access the contents of the corresponding Java® Application Descriptor (JAD) file to read attributes embedded in the file.

The following is a sample JAD file:

Manifest-Version: 1.0
MIDlet-Version: 1.0.1
MIDlet-Name: My App
MIDlet-Description: My description
MIDlet-Vendor: My Company, Inc.
RIM-COD-Module-Name: Sample JAD
RIM-COD-URL-1: FileOne.cod
RIM-COD-Size-1: 20000
RIM-COD-URL-2: FileTwo.cod
RIM-COD-Size-2: 10000
My-Custom-JAD-Property: Hello There!

In BlackBerry Device Software 4.3 and later, the BlackBerry smartphone introduces support for programmatically reading the contents of the JAD file added or modified after the application has been built. This allows a developer to add dynamic content to a JAD file that could be unique for a particular user or installation.

Custom JAD attributes can be read prior to JAD version 4.3.0. However, the custom JAD file attributes must be added to the JAD file before build time and cannot be modified after the application has been built. To accomplish this the JAD file must be added to the project in the BlackBerry Java® Development Environment (BlackBerry JDE) or BlackBerry® JDE Plug-in for Eclipse™. This means that the custom attribute is identical for all BlackBerry smartphone users who install the application and are using BlackBerry Device software 4.3.0 or earlier.

For a MIDlet, JAD file attributes can be read by calling MIDlet.getAppProperty(). For a Connected Limited Device Configuration (CLDC) application that is leveraging the BlackBerry smartphone application programming interfaces (API), JAD file attributes can be read by callingCodeModuleGroup.getProperty(). Examples for each application type are provided below.

MIDlet example:

String description = MIDlet.getAppProperty("MIDlet-Description");
String custom = MIDlet.getAppProperty("My-Custom-JAD-Property");

BlackBerry smartphone API example:

CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll();
CodeModuleGroup myGroup = null;
String moduleName = ApplicationDescriptor
   .currentApplicationDescriptor().getModuleName();

for (int i = 0; i < allGroups.length; i++) {
   if (allGroups[i].containsModule(moduleName)) {
      myGroup = allGroups[i];
      break;
    }
}

// Get the property
String description = myGroup.getProperty("MIDlet-Description");
String custom = myGroup.getProperty("My-Custom-JAD-Property");

For more information on JAD files and publishing applications over the wireless network, see theDeploying Java Applications whitepaper.

Note: Auto-start applications that read JAD file attributes should implement a short delay (approximately 1 second) before attempting to read JAD file attributes on its first startup. When an auto-start application is installed it will start up in parallel to the BlackBerry smartphone saving the JAD file information. This can result in a race condition where the application tries to read the attributes before they have been saved, resulting in a failure to access the attributes. This only occurs the first time an application is installed and the BlackBerry smartphone is not restarted during the installation.

 

Keywords

deploy, OTA, over the air, JAD, property, read, application, descriptor, MIDlet, CLDC, getAppProperty, CodeModuleGroup

分享到:
评论

相关推荐

    swift-programmatically, 以编程方式无需 Storyboard.zip

    swift-programmatically, 以编程方式无需 Storyboard 基于编程的以编程方式无需 Storyboard在UITabBarController中以编程方式在中添加制表符func application(application: UIApplication, didFinishLau

    hibernate_reference.pdf

    - **Contextual Sessions**: Discusses the use of contextual sessions, which allow you to manage the lifecycle of a session within a transactional context. #### Configuration Configuration plays a ...

    Getting.started.with.Spring.Framework.2nd.Edition1491011912.epub

    The book shows a simple internet banking application that is developed incrementally in each chapter of the book and covers the topics mentioned above. You can post your feedback and questions to the ...

    Learning pyspark

    submit command., By the end of this book, you will have established a firm understanding of the Spark Python API and how it can be used to build data-intensive applications., Style and approach, This ...

    Learning PySpark

    submit command., By the end of this book, you will have established a firm understanding of the Spark Python API and how it can be used to build data-intensive applications., Style and approach, This ...

    DevExpress VCL 12.2.6(v2012vol2.6) 源码-例子-帮助-part1

    Q484199 - Documentation - Provide an example of how to use the TcxCustomTreeList.Find function Resolved Issues VCL Subscription B232998 - Documentation - The OnValidateDrawValue event is not ...

    DevExpress VCL 12.2.6(v2012vol2.6) 源码-例子-帮助-part2

    Q484199 - Documentation - Provide an example of how to use the TcxCustomTreeList.Find function Resolved Issues VCL Subscription B232998 - Documentation - The OnValidateDrawValue event is not ...

    Practical Data Wrangling

    By the end of the book, you will have a thorough understanding of all the data wrangling concepts and how to implement them in the best possible way. What you will learn Read a csv file into python ...

    Hacking.Secret.Ciphers.with.Python.B00WOY87ZU

    Instead of presenting a dull laundry list of concepts, this book provides the source code to several fun programming projects for adults and young adults. Table of Contents Chapter 1 - Making Paper ...

    Complex Network Analysis in Python-The Pragmatic Programmer(2018).pdf

    the way to network-based cultural domain analysis and a marketing study of Sephora cosmetic products. If you cannot find any direct or indirect relationships between the items, but still would like to...

    Android代码-手电筒演示

    This application is demonstrate the use of flashlight of the camera. You can find complete tutorial of it here: ...

    Amazon Web Services in Action(Manning,2015)

    You'll learn how to automate your infrastructure by programmatically calling the AWS API to control every part of AWS. Next, you'll learn options and techniques for storing your data. You'll also ...

    SMDK for DotNet

    Please refer to the Readme.htm file provided with the SMDK for .NET for the latest information on updating your terminal for use with the class libraries and for information on how to deploy your ...

    Mastering_Perl_Tk_1st_ed_2002.pdf

    The concept of "on" and "off" values for checkbuttons is explained, including how to set and retrieve these values programmatically. **4.8 Radiobutton Values** Similar to checkbuttons, the values ...

Global site tag (gtag.js) - Google Analytics