Retrieving the profile box settings for your application

The net.rim.blackberry.api.bbm.platform.SettingsManager class allows your application to obtain a user's setting for the profile box for your application. For example, you can determine whether your application's profile box is enabled or disabled.

To obtain the status of the profile box for your application, you must first obtain your application's SettingsManager object by invoking getSettingsManager() on your application's BBMPlatformContext object.

To determine the status of the profile box setting, invoke SettingsManager.getSetting() and specify SETTING_PROFILE_BOX as the field to return.

If the profile box for your application is disabled, you can prompt the user to enable your application's profile box by invoking requestAppSettings() on your application's BBMPlatformContext object.

private static void alertIfNotShowingProfile()
{
    // Obtain the value of the profile box setting

    final SettingsManager settingsMgr = context.getSettingsManager();
    final int profileBoxSetting = settingsMgr.getSetting
     (SettingsManager.SETTING_PROFILE_BOX);

    // If the 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,
         "Would you like this application to appear in your profile?"))
        {
            // If the user agrees, prompt the user to go to the options screen

            context.requestAppSettings();
        }
    }
}

Was this information helpful? Send us your comments.