Hack 99. Control BlackBerry Applications in the Enterprise


While the BlackBerry platform is relatively easily deployed, enterprises with more stringent security concerns or those required to meet recent regulations such as Sarbanes-Oxeley must take steps to assure their BlackBerry implementation is consistent with these needs.

Research In Motion provides a comprehensive set of IT policies to control the general aspects of the device. However, the BlackBerry is increasingly being used as a platform to solve business problems. As such, companies are deploying both third-party and internally developed applications to their BlackBerry devices. This hack will discuss the application of IT policies in custom applications.

There are two primary use cases for IT policies in BlackBerry solutions:

  • Provide configuration data, which can change in the future, to all devices in the enterprise.

  • Hide application complexity from users.

Many wireless applications depend on server resources. These server resources may be specified by a DNS name, URL, or IP address. How does a BlackBerry administrator or BlackBerry application designer allow configuration data such as this to be easily deployed to all devices and for this data to be updated? It would be possible to include a configuration file in the deployment of an application that contains important metadata. However, what happens six months later when this data must change? IT policies provide a simple way for the BES administrator to update configuration data about a given application and have it automatically pushed to all devices. It is even possible for the BES administrator to provide certain configuration data to some user groups and different configuration data to others. This might be useful to hide complex application configuration options from users who are known to require only basic functionality.

Suppose you want to add a URL to a custom BES IT policy that will be retrieved by a custom application on devices throughout the enterprise. If the URL changes in the future, the BES admin just updates the BES setting, and all devices receive the update.

Using an IT policy to provide configuration data requires that the custom policy is properly configured on the BES and that the application properly queries the BES for the custom setting.

9.7.1. Configure the BES

The first step in configuring the BES is creating the custom rule. This is done in an entirely separate area of the BES than where policies are configured and applied. In BES 4.0, launch the BlackBerry Manager and right-click on BlackBerry Server Management. Select Properties and select the Policy Rules tab shown in Figure 9-9. To create a new rule, click the New rule button.

Figure 9-9. The Policy Rules tab


In this case, call the new rule CustomAppMainURL, set the type to String, and set the Destination to handheld. You must then provide a description for the IT policy. It is a common misconception that the Description field contains the value for the Rule (see Figure 9-10). The Description is just a way to document the purpose of the field; the actual default value is set later..

Rule types are not limited to String (although this is the most appropriate for this example). Other supported rule types are Boolean, integer, bitmask, and multiline string.

Now you must either edit an existing IT policy or create a new one. Create a new one as shown in Figure 9-11. Right-click on the BlackBerry server name underneath BlackBerry Server Management, select IT Policy, and click New. Create a new IT policy called ourCustomUserPolicy. Note that in addition to the standard BlackBerry policies, the new custom policy that you just created now appears.

Selecting the customAppMainURL policy immediately causes the dialog shown in Figure 9-12 to appear. Here is where you enter the actual data that you want to be sent to the custom handheld application.

Figure 9-10. Creating the new rule


Figure 9-11. Creating the new policy


The BES server is now configured to pass down the custom data to the handheld application when asked.

You must add the appropriate BES users to the IT policy you created or they will not receive the custom setting!


Figure 9-12. Typing the URL


9.7.2. Code the Custom Application

Now that the BES has been configured, all that is left is to query the BES from your application. This will not cover all aspects of building a BlackBerry application just those points pertinent to IT policy.

In your .java file, include the RIM IT policy library:

 import net.rim.device.api.itpolicy.*; 

The code to get the IT policy is incredibly simple:

 String itPolicyDataURL= ITPolicy.getString("customAppMainURL","http:// defaultURL"); 

Provided that you configured the IT policy correctly, the value of itPolicyDataURL will be http://www.ourCustomAppURL.com/data. In the event the device is unable to retrieve the IT policy, the http://defaultURL string that was passed as a default will be used.

There is a known bug in BlackBerry Enterprise Server 4.0 and the current 4.0 handheld software that prevents devices from properly receiving custom IT policies. The BES server will show an error on pushing an IT policy that contains any custom entries. This is clearly a serious issue that RIM is aware of. Until the bug is corrected, consider using an existing and relatively unused standard policy, and overload it to use all of your settings.


Jeff Greenhut



BlackBerry Hacks
Blackberry Hacks: Tips & Tools for Your Mobile Office
ISBN: 0596101155
EAN: 2147483647
Year: 2006
Pages: 164
Authors: Dave Mabe

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net