Solicitar que o usuário altere as definições do BlackBerry Messenger para seu aplicativo
A interface net.rim.blackberry.api.bbm.platform.BBMPlatformContext fornece um método, requestAppSettings(), que permite que o aplicativo exiba a tela de opções do BBM™ em primeiro plano para que o usuário possa ajustar as definições do aplicativo. Isto é útil quando o aplicativo consultar determinadas definições, como uma conexão com o BBM ou exibir uma caixa de perfil no perfil BBM do usuário.
// 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
}
}
}
}
Próximo tópico: Obtenção de informações sobre a maneira como seu aplicativo é executado no BlackBerry Messenger
Tópico anterior: Recuperação da definição de conexões públicas do seu aplicativo
Estas informações foram úteis? Gostaríamos de receber seus comentários.