问题描述
我有一个要求,在使用应用程序的后台进程,同时还通过另一种切入点有一个UIApplication的。
I have a requirement to have a background process using Application, while also having a UiApplication through an alternative entry point.
现在,一切都很正常,我能够在它们之间天晴,当谈到告诉UIApplication的从后台进程接近沟通。
Now, everything works great and I'm able to communicate between them fine, apart from when it comes to telling the UiApplication to close from the background process.
我已经尝试了一些方法:
I've tried a number of methods:
UiApplication.getUiApplication()。requestClose()
不起作用。
我已经尝试设置一个布尔值设置为true,其中的UIApplication检查每一秒,看它是否是真还是假,如果是的话,它会自行关闭。不工作...
I've tried setting a boolean value to true, which the UiApplication checks every second to see if it's true or not, if so, it closes itself. Doesn't work...
UiApplication.getUiApplication().invokeLater(new Runnable(){
public void run(){
System.exit(0);
}
});
任何人有这方面的经验谁可以点我在正确的方向?
Anyone have experience in this who can point me in the right direction?
推荐答案
前景色和背景是不同的程序,他们没有共享数据存储器。所以基本上你可以不设置任何布尔在一个应用程序,只是检查它在另一个。
Background and Foreground are different processes and they aren't sharing data memory. So basically you can't set any boolean in one app and just check it in another.
不过,既然你有两个应用程序之间的通信已经,可能使用 ApplicationManager.postGlobalEvent()
,你可以添加其他事件退出。
But since you have communication between two apps already, probably using ApplicationManager.postGlobalEvent()
, you can add another event "Exit".
这篇关于黑莓收盘UIApplication的替代入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!