대화 상대에게 다운로드 초대 보내기
시작하기 전에: BlackBerry Messenger 플랫폼에 프로그램 등록 작업을 완료하고
MyBBMInviteScreen 화면을 표시하는 클래스가 프로그램과 연결된
BBMPlatformContext 개체에 대한 참조를 화면의 생성자에 전달하도록 합니다.
- 필요한 클래스와 인터페이스를 가져옵니다.
import net.rim.blackberry.api.bbm.platform.*;
import net.rim.blackberry.api.bbm.platform.service.*;
import net.rim.device.api.ui.component.*;
- MainScreen을 확장하는 클래스를 만듭니다. 이 화면 클래스의 생성자에서 프로그램과 연결된 BBMPlatformContext를 전달합니다.
public class MyBBMInviteScreen extends MainScreen
{
public MyBBMInviteScreen(BBMPlatformContext platformContext)
{
}
}
- 생성자에서 이 프로그램의 플랫폼 컨텍스트와 연결된 메시징 서비스에 대한 참조를 검색합니다.
public class MyBBMInviteScreen extends MainScreen
{
public MyBBMInviteScreen(BBMPlatformContext platformContext)
{
MessagingService messagingService = platformContext.getMessagingService();
}
}
- MessagingService.sendDownloadInvitation()을 호출하여 대화 상대가 프로그램을 다운로드하도록 초대합니다. 사용자가 초대할 대화 상대를 선택할 수 있도록 대화 상대 선택기 UI 구성 요소가 열립니다.
public class MyBBMInviteScreen extends MainScreen
{
public MyBBMInviteScreen(BBMPlatformContext platformContext)
{
MessagingService messagingService = platformContext.getMessagingService();
messagingService.sendDownloadInvitation();
}
}
코드 샘플: 대화 상대에게 다운로드 초대 보내기
다음 코드 샘플에서는 MyBBMInviteScreen을 표시한 클래스가 프로그램과 연결된 BBMPlatformContext 개체에 대한 참조를 MyBBMInviteScreen 생성자에 전달했다고 가정합니다.
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
{
public MyBBMInviteScreen(BBMPlatformContext platformContext)
{
MessagingService messagingService = platformContext.getMessagingService();
messagingService.sendDownloadInvitation();
}
}
이 정보가 도움이 되었습니까? 의견을 보내 주십시오.