アプリケーションから別のユーザーにピンメッセージを送信するためにBBMSDKを使用する必要はありません。BBピンはBBMだけに限定されません。これは、Pinを使用してメッセージを送信するために使用できるBlackberryの一意の識別子です。また、BBMと一緒にPINを使用して、BBMでメッセージを送信することもできます。テキストフィールドにピンを入力し、事前に入力されたメッセージを送信する必要がある場合は、BBMを使用する必要はありません。次の方法を使用して、ピンメッセージを送信できます
public static void sendPinMessage(String address,String body)
{
Store store = Session.getDefaultInstance().getStore();
//retrieve the sent folder
Folder[] folders = store.list(Folder.SENT);
Folder sentfolder = folders[0];
//create a new message and store it in the sent folder
Message msg = new Message(sentfolder);
PINAddress recipients[] = new PINAddress[1];
try{
//create a pin address with destination address
recipients[0]= new PINAddress(address,"My app");
}
catch (AddressException ae)
{
Log.Error(ae,"Check address");
}
try{
//add the recipient list to the message
msg.addRecipients(Message.RecipientType.TO, recipients);
//set a subject for the message
msg.setSubject("Subject");
//sets the body of the message
msg.setContent(body);
//send the message
Transport.send(msg);
}
catch (MessagingException me)
{
Log.Error(me,"Message excpetion in sending pin");
}
}