我想从后台应用程序打开我的 UI 应用程序。它是如何完成的?
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 屏幕。这是怎么做到的?我试过这个:
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();
}
但它没有打开用户界面。