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

Java Development

Application Indicators and Home Screen Integration

by BlackBerry Development Advisor on ‎11-19-2010 09:08 AM (14,913 Views)

Summary

 

This article applies to BlackBerry® devices based on Java® technology.

 


Description

 

BlackBerr®y Device Software version 6.0 introduced a new feature that allows a user to quickly see a summary of current events and notifications.  Clicking on the indicator area of the Home Screen brings up a notification summary, as is shown in the following screen shot.

 

 

Notifications.png

 

 

Applications can add their own indicator icons to the home screen.  However, unless they also add a custom message the application will not be included in the notification summary as shown in the following screenshot.

 

Code sample for adding a indicator icon:

 

 

ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();    

EncodedImage image = EncodedImage.getEncodedImageResource("Indicator.png");
ApplicationIcon icon = new ApplicationIcon( image );
ApplicationIndicator indicator = reg.register( icon, false, true); indicator.setIcon(icon); indicator.setVisible(true);

 

 

NoHomeScreenIntegration.png

 

 

An application can create add a single custom message that can be used to populate the notification summary.  When a user clicks on the summary message, the application is invoked.

 

Code Sample:

 

 

//Register the ApplicationMessageFolder
//ReadableListImpl source is available in the messagelistdemo.
ApplicationMessageFolder folder = ApplicationMessageFolderRegistry.getInstance().registerFolder(
		0x33c7ce29883abe5fL, "Test Folder", new ReadableListImpl());

//DemoMessage source is available in the messagelistdemo.
DemoMessage msg = new DemoMessage("me@here.com", "Pizza Toppings", 
		"What would you like on your pizza?", System.currentTimeMillis());
folder.fireElementAdded(msg);

//Display the application indicator icon.
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();    

EncodedImage image = EncodedImage.getEncodedImageResource("Indicator.png");
ApplicationIcon icon = new ApplicationIcon(image);
ApplicationIndicator indicator = reg.register(icon, false, true); indicator.setIcon(icon); indicator.setVisible(true);

 

Screenshot:

 

HomeScreenIntegration.png

 

 

Applications that add custom messages can specify whether or not they are displayed in the notification summary.  This is done using the ApplicationFolderIntegrationConfig, which was added in BlackBerry Device Software version 6.0 as shown in the code sample below, which is an extension of the previous sample.  The end result will appear like the second screenshot in this article.

 

 

//Create the ApplicationFolderIntegrationConfig.  
//The second boolean parameter controls home screen integration.
ApplicationFolderIntegrationConfig config = new   ApplicationFolderIntegrationConfig(
        false, false, ApplicationDescriptor.currentApplicationDescriptor());

//Register the ApplicationMessageFolder
//ReadableListImpl source is available in the messagelistdemo.
ApplicationMessageFolder folder = ApplicationMessageFolderRegistry.getInstance().registerFolder(
        0x33c7ce29883abe5fL, "Test Folder", new ReadableListImpl(), config);

//DemoMessage source is available in the messagelistdemo.
DemoMessage msg = new DemoMessage("me@here.com", "Pizza Toppings",
        "What would you like on your pizza?", System.currentTimeMillis());
folder.fireElementAdded(msg);

//Display the application indicator icon.
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();    
EncodedImage image = EncodedImage.getEncodedImageResource("Indicator.png");

ApplicationIcon icon = new ApplicationIcon( image );

ApplicationIndicator indicator = reg.register( icon, false, true);
indicator.setIcon(icon);
indicator.setVisible(true);
Users Online
Currently online: 25 members 1,841 guests
Please welcome our newest community members: