Prompting the user to change the BlackBerry Messenger settings for your application
The net.rim.blackberry.api.bbm.platform.BBMPlatformContext interface provides a method, requestAppSettings(), that allows your application to bring its BBM options screen to the foreground so that the user can adjust the settings for the application. This is useful when the application requires certain settings, such as a connection to BBM or to display a profile box in the user’s BBM profile.
// Prompt the user to enable the profile box setting
private static void alertIfNotShowingProfile()
{
// Retrieve the settings manager associated with the application
final SettingsManager settings = context.getSettingsManager();
// Retrieve the profile box setting
final int profileBoxSetting =
settings.getSetting(SettingsManager.SETTING_PROFILE_BOX);
// If the profile box setting is disabled, ask the user to change the setting
if(profileBoxSetting == SettingsManager.VALUE_DISABLED)
{
if(Dialog.D_OK == Dialog.ask(Dialog.D_OK_CANCEL, "You have not enabled this
application to appear in your profile. Would you like to enable it?"))
{
// If the user agrees, bring up the BBM options screen
try
{
context.requestAppSettings();
}
catch(ControlledAccessException e)
{
// Code that runs when the BBM platform access status is not
// ACCESS_ALLOWED or is ACCESS_BLOCKED_BY_USER
}
}
}
}
Next topic: Obtaining information about how your application is invoked from within BlackBerry Messenger
Previous topic: Retrieving the public connections setting for your application