これは私はそれが私のために働い使用して終了コードであるが上書き
private static boolean flag=false;
public static void main(String[] args)
{
StartUp startUp;
if(args!=null && args.length>0 && args[0].equals("gui")){
flag=false;
startUp = new StartUp("gui");
startUp.enterEventDispatcher();
}else{
flag=true;
startUp = new StartUp();
startUp.enterEventDispatcher();
}
}
を次のように我々のアプリケーション に、このメソッドをオーバーライドします。最初はacceptsForegroundをメインランチャークラスに入れてみましたが、実行中のタスクメニューに表示されないようにPushListener自体に入れました。うまくいった。
ランチャークラス
public static void main(String[] args) {
if (args != null && args.length > 0 && args[0].equals("gui")) {
MyApp app = new MyApp();
app.enterEventDispatcher();
} else {
PushListener.waitForInstance().start();
}
}
PushListenerクラス
protected boolean acceptsForeground() {
return false; // You could use a variable instead if you wanted.
}