Retrieving available goods

You can call DigitalGoods.get() to retrieve a list of all the digital goods available for purchase within your application.

You can retrieve available SKUs for your application by invoking DigitalGoods.get(DigitalGoodsListingListener listener), which uses a callback listener. When invoking this asynchronous method, consider the following points:

  • To prevent garbage collection, assign the callback object to a class field so that the calling application maintains a reference for the listener. This will prevent garbage collection.
  • Do not use a synchronous wrapper because it blocks the event thread, and the callback does not return.

Invoking get() returns an array of DigitalGood objects through the Success method of the DigitalGoodsListingListener. Each result in the array contains details about a purchase, such as the SKU, vendor, name of the digital good, short and long descriptions, and the PriceSet of the digital good. Details of the digital good are stored locally on the BlackBerry device.

Code sample: Retrieving details about digital goods

private DigitalGoodsListingListener listener;
public void getChildItems() {
    listener = new DigitalGoodsListingListener() {
        public void error( String message, int errorCode ) {
            // Handle error
        public void success( DigitalGood[] digitalGoods ) {
            // Handle the digital goods

Was this information helpful? Send us your comments.