BlackBerry Java SDK 7.1
This page lists new features for the BlackBerry Java SDK 7.1.
For BlackBerry Java SDKBlackBerry Java SDK 7.1, the documentation is moved into the format you are now viewing.
Documentation for earlier versions is still available at the old location, Java Development Guides and API Reference. (Use the version dropdown list to open earlier versions.)
Near Field Communication (NFC)
You can use the LLCPConnection and LLCPConnectionNotifier interfaces in the net.rim.device.api.io.nfc.llcp package to open a client or server connection with another NFC-enabled device.
To communicate with an NFC peer as a client, open a connection using the java.microedition.io.Connector.open() method. Cast the returned object as an LLCPConnection to retrieve the input and output streams for the connection.
In your connection string, you can define the service name or service access point for the connection. If you choose to use a service access point for your application, you should check whether the NFC Forum has reserved the service access point number.
To communicate with an NFC peer as a server, you can retrieve a Connection object using the LLCPConnectionNotifier interface. When you are ready to listen for a connection request, you can invoke LLCPConnectionNotifier.acceptAndOpen().
Simple NDEF Exchange Protocol
You can respond to NDEF push requests that use the Simple NDEF Exchange Protocol (SNEP) using the classes and interfaces in the net.rim.device.api.io.nfc.push package. When the BlackBerry device detects a SNEP request, it notifies any applications that registered interest in responding. Implement the NDEFMessageBuilder interface to create an NDEF message when a request arrives, and register your implementation using the NDEFPushManager class.
The device also notifies applications about the status of push requests. To receive status notifications, implement and register the NDEFPushStatusCallback using NDEFPushManager.
You can register for notification of connection handover events using the classes and interfaces in the net.rim.device.api.io.nfc.handover package. Only Bluetooth connection handovers are supported in the BlackBerry Java SDK 7.1.
A connection handover event begins when the device detects a smart tag that contains Bluetooth pairing information. The device negotiates a Bluetooth connection and passes the connection details to any applications that registered a ConnectionHandoverListener implementation. You can register a listener using the ConnectionHandoverManager class.
NDEF Helper Classes
The net.rim.device.api.io.nfc.ndef.rtd package contains classes that can help you parse and create well-formed NDEF records. You can create SmartPosterRecord, TextRecord, and URIRecord objects from the payload of an NDEF message that you retrieve from a smart tag.
The RTD helper classes also provide methods to help you wrap your data in common NDEF record types, such as smart poster, text, and URI. You can then add the objects you create to an NDEF message. The net.rim.device.api.io.nfc.ndef.NDEFMessageUtils class contains methods to create fully formed NDEF messages that include the data you provide.
Some BlackBerry devices are equipped with FM radio receivers. You can create an application that receives FM radio transmissions and metadata transmitted using the Radio Data System (RDS) protocol.
When you create a media player, provide "capture://radio" as the locator string parameter to the method javax.microedition.media.Manager.createPlayer. After you put the media player in the REALIZED state, you can retrieve an instance of the tuner control using player.getControl. Similarly, you can access RDS data using the javax.microedition.amms.control.tuner.RDSControl interface.
Setting minimum logging levels
You can now use methods in the EventLogger class to set the minimum logging level for all registered event loggers in an application, or set the minimum logging level for only specific event loggers. You can also set the global minimum logging level for all event loggers. This change is designed to prevent performance issues on a BlackBerry device when the minimum logging level was inadvertently set to a level that was too verbose (such as INFO or DEBUG_INFO).
Previously, you could invoke the setMinimumLevel(int) method to set the global minimum logging level, which would affect all event loggers. Invoking this method now changes the minimum logging level of only the event loggers that were registered by the calling application. You can invoke the setMinimumLevel(int, int) method to change the minimum logging level of a specific event logger. You can invoke the setGlobalMinimumLevel(int) method to change the global minimum logging level, which performs the same action the previous version of setMinimumLevel(int).
You can invoke several other methods to support this new functionality, including getEffectiveMinimumLevel(), getMinimumLevel(), and unsetMinimumLevel(). For more information about these methods, refer to the EventLogger class in the API Reference for the BlackBerry Java SDK.
You can now do an integrity check of an entire database (checking for out-of-order records, missing pages, and malformed records) with the new quick_check pragma. You can also use the new integrity_check pragma to check all of the same things as well as corrupt indices.
Listening for Setup application events
You can use the SetupListener interface to listen for state change events from the Setup application on a BlackBerry device. You can determine whether the Setup Wizard is running, and your application can receive a notification when the Setup Wizard is complete. You can register to receive notifications from a SetupListener by using the SetupManager class.
Listening for rotation events
You can use the RotationListener interface to listen for orientation changes on a BlackBerry device. Your application can use this interface to respond when a user rotates the device. You can register to receive notifications from a RotationListener by using the RotationEventDispatcher class.
Managing notification profiles
You can use the Profiles API, which is included in the net.rim.blackberry.api.profiles package, to manage and customize the notification profiles that are available on the BlackBerry device. You can retrieve a list of notification profiles on the device, determine which profile is currently active, and set the active profile. You can use this information to define the behavior of your application based on the active profile. For example, your application can provide only vibration notifications if the active profile on the device is the Quiet profile.
You can also customize the existing notification profiles, including separate notifications for different contacts. For example, you can modify vibration settings, LED blink settings, and audio tunes to play for each profile. You can also distinguish between profiles that affect different application notifications on the device, such as phone notifications, reminder notifications, and BlackBerry Messenger notifications.