Developing for BlackBerry

The BlackBerry platform uses the MintChip Java API found within the API Reference section of this website. To help you quickly get coding on BlackBerry with the MintChip Java API we provide a sample package.

The latest BlackBerry sample package can be found within the download section of this site.

The MintChip Sample application demonstrates the following concepts:

  • Building and deploying a BlackBerry application that uses the MintChip API
  • Using the MintChip API to:
    • Create a Value Message (.ecn file)
    • Accept a Value Message (.ecn file)
    • Read the MintChip transaction log
    • Read the MintChip infomation and status

The MintChip Sample application presented here has been developed with the intention to make the understanding of these concepts as straightforward as possible. Even though it is a fully functional application, in order to achieve these goals some of the common development practices have been foregone. The application cannot be considered production ready and is not intended for any other usage but to be a sample demonstration of the MintChip Java API specifications.

Prerequisites

To deploy and run the pre-built application the following are required:

  • A BlackBerry phone running OS version 5 or higher.
  • A microSD card containing the MintChip installed on the phone.

To create a development project in order to compile the code it is recommended to use the BlackBerry Java Plug-in for Eclipse that can be downloaded from the BlackBerry development site.

What's in the Sample Package

The MintChip Sample application package includes two folder:

  • project, which contains the BlackBerry Java Plug-in for Eclipse project with the application source code.
  • setup, which contains the files required to deploy the MintChip API as well as the pre-built MintChip Sample application itself to the BlackBerry phone. This folder also contains JAR files that can be used to build BlackBerry applications that use the MintChip API.

How to use the MintChip Java API

The MintChip API are implemented by the classes contained in the ca.mint.mintchip.blackberry.api and ca.mint.mintchip.contract packages.

A typical approach to using the MintChip API in an BlackBerry application would involve the following steps.

  1. Reference the ca.mint.mintchip.android.api and ca.mint.mintchip.contract Java packages. This can be done by referencing the following JAR files from the BlackBerry Eclipse project:
    • MintChipAndroidAPi.jar
    • MintChipCommon.jar
  2. Import the MintChip API packages into your source code file:
    • import ca.mint.mintchip.blackberry.api.*;
    • import ca.mint.mintchip.contract.*;
  3. Create an instance of the class that implements the IMintChip interface, which is the main interface to invoke the MintChip functionality:
  4. IMintChip mintChip = MintChipFactory.getInstance().createMintChip();      
    
  5. Use MessageFactory to instantiate message types:
    IValueRequestMessage request = (IValueRequestMessage)
        MessageFactory.getInstance().toMessage(base64Request);
    
  6. Call methods of the IMintChip interface and be prepared to handle the MintChipException:
    IValueMessage valueMessage;
    try {
        valueMessage = mintChip.createValueMessage(request);
    }
    catch (MintChipException e) {
        // TODO Handle the exception
    }
    

Please see the MintChipUtility.java source code file included in the MintChipSample project for more examples on how the MintChip API can be used to create value messages, accept payments in the form of value messages, read the transaction log and the detail information of the MintChip installed on a BlackBerry device.