我使用简单的方法在http://docs.blackberry.com/en/developers/deliverables/25690/Register_your_app_with_the_BBM_Platform_1387557_11.jsp的BlackBerry Messenger平台中创建和注册我自己的应用程序。我在设置监听器部分之后放了屏幕推送命令,所以我有这个代码:
platformContext.setListener(platformContextListener); this.pushScreen(new ApplicationScreen(platformContext));
ApplicationScreen是我自己的屏幕类:
公共类ApplicationScreen扩展了MainScreen {
public ApplicationScreen(BBMPlatformContext platformContext){
super(DEFAULT_MENU | DEFAULT_CLOSE);
setTitle("BBM application");
this.add(new LabelField("Screen of BBM application"));
if (platformContext.isAccessAllowed()){
platformContext.getUIService().startBBMChat("Let's chat!");
} else {
int error = platformContext.getAccessErrorCode();
this.add(new LabelField("AccessAllowed: no"));
this.add(new LabelField(translateAccessStatus(error)));
}
}
private static String translateAccessStatus(int status) {
switch (status) {
case BBMPlatformContext.ACCESS_ALLOWED: return "Allowed";
case BBMPlatformContext.ACCESS_PENDING_REGISTRATION: return "Registration Pending";
case BBMPlatformContext.ACCESS_BLOCKED_BY_SERVER: return "Blocked by Server";
case BBMPlatformContext.ACCESS_BLOCKED_BY_USER: return "Blocked by User";
case BBMPlatformContext.ACCESS_BLOCKED_DUPLICATE_INSTANCE: return "Blocked duplicate instance";
default: return "Unknown";
}
}
}
但我总是只有AccessAllowed:no;注册待定。这是什么意思,我不正确的是什么?我只需要简单的测试应用程序,它可以在BBM中注册并为我提供接口。现在我不知道我错在哪里。