本文介绍了黑莓替代入口点 - 从后台应用程序启动应用程序(在推送消息点击时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从后台应用程序打开我的 UI 应用程序.它是怎么做的?.
I want to open my UI app from a background application. How its done ?.
public static void main(String[] args) {
if (args.length > 0 && args[0].equals("MYAPP") ){
theApp = new App();
theApp.enterEventDispatcher(); ///this is my ui class
}
else {
BackgroundApplication app = new BackgroundApplication();
app.setupBackgroundApplication();
app.enterEventDispatcher(); ///this is a background application listen for push notifications
}
}
当我收到推送通知时,BackgroundApplication
应该会提醒一个弹出窗口.当我单击弹出窗口时,我希望它打开 UI 屏幕.这是怎么做的?我试过这个:
When I get a push notification, the BackgroundApplication
should alert a popup.When I click the popup, I want it to open the UI screen. How is this done? I tried this:
int modHandle = CodeModuleManager.getModuleHandle("MYAPP");
ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
try {
ApplicationManager.getApplicationManager().runApplication(apDes[0]);
} catch (ApplicationManagerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
但它没有打开用户界面.
But it's not opening the UI.
推荐答案
您应该将参数MYAPP"传递给正在运行应用程序的代码:
You should pass argument "MYAPP" to code that's running application:
ApplicationDescriptor[] appDescriptors =
CodeModuleManager.getApplicationDescriptors(
CodeModuleManager.getModuleHandle("MYAPP"));//.Cod file name
ApplicationDescriptor appDescriptor = new ApplicationDescriptor(
appDescriptors[0], new String[] {"MYAPP"});
ApplicationManager.getApplicationManager().runApplication(appDescriptor);
阅读更多这里
这篇关于黑莓替代入口点 - 从后台应用程序启动应用程序(在推送消息点击时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!