Mengkonfirmasi pengguna untuk mengganti setelan BlackBerry Messenger bagi aplikasi Anda
Antarmuka net.rim.blackberry.api.bbm.platform.BBMPlatformContext menyediakan sebuah metode, requestAppSettings(), yang memungkinkan aplikasi Anda menampilkan layar opsi BBMnya ke latar depan sehingga pengguna bisa menyesuaikan setelan untuk aplikasi. Ini berguna saat aplikasi memerlukan setelan tertentu, seperti koneksi ke BBM atau untuk menampilkan kotak profil dalam profil BBM pengguna.
// 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
}
}
}
}
Topik berikutnya: Mendapatkan informasi tentang cara aplikasi Anda diaktifkan dari dalam BlackBerry Messenger
Topik sebelumnya: Mengambil setelan koneksi umum untuk aplikasi Anda
Apakah informasi ini berguna? Kirimkan komentar Anda kepada kami.