Échantillon de code : envoi d'une invitation d'adhésion à un contact
L'échantillon de code suivant suppose que la classe qui a affiché MyBBMInviteScreen a transmis une référence à l'objet BBMPlatformContext associé à l'application dans le constructeur MyBBMScreen.
Cet échantillon de code suppose également que vous avez terminé la tâche Définir un écouteur de canal et nommé la classe d'écouteur de canal MyChannelListener.
import net.rim.blackberry.api.bbm.platform.*;
import net.rim.blackberry.api.bbm.platform.service.*;
import net.rim.device.api.ui.component.*;
public class MyBBMInviteScreen extends MainScreen
{
public MyBBMInviteScreen(BBMPlatformContext platformContext)
{
MessagingService messagingService = platformContext.getMessagingService();
BBMPlatformChannel channel = messagingService.createChannel(new MyChannelListener());
if (channel != null)
{
channel.sendInvitation(“Let's play a game”, "Chess App", 0);
}
}
}
Sujet suivant: Envoyer un message à un contact
Sujet précédent: Envoyer une invitation d'adhésion à un contact
Ces informations vous ont-elles été utiles ? Envoyez-nous vos commentaires.