次のアクティビティ実行ロジックを備えたAndroidアプリケーションがあります。
if FIRST_RUN
:SplashScreeen->ログオン-> MainScreenTabHost
if PUSH
:
Not Running
:SplashScreeen->ログオン-> MainScreenTabHostRunning
:MainActivity
メッセージを受信します
これを達成する方法がわかりません。NotificationBar
アイテムの私のソースコード:
Notification notif = new Notification(R.drawable.ic_launcher, "Text in status bar",
System.currentTimeMillis());
Intent intent = new Intent(this, MainScreenTabHost.class);//HERE PROBLEM
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
notif.setLatestEventInfo(this, "Notification's title", "Notification's text", pIntent);
notif.flags |= Notification.FLAG_AUTO_CANCEL;
this.notificationManager.notify(1, notif);
このコードは常にアプリケーションを実行しますMainScreenTabHost
が、アプリケーションが実行されていない場合は、ログオン画面で初期化されます。
私の質問は、アプリケーションが実行されていることを確認し、実行されていない場合は、Intent
スプラッシュ画面を実行してFIRSTRUNを繰り返す方法を教えてください。一方、アプリケーションが実行されている場合はIntent
、いくつかの操作のために(おそらくブロードキャスト)を送信したいだけです。
そして、1つは、プッシュ通知からのブロードキャストインテントによって実行されるため、私のサービスが常に実行されているとは限りません。