私のアプリケーションは全画面モードで実行する必要があります。また、新しいアイテムがサーバーからアプリに到着したときに通知バーを表示する必要があります。BroadcastReceiver クラスに通知用のコーディングを記述します。MainActivity で、新しい通知を受け取ったときにのみステータス バーを表示するように決定したいと思います。それ以外の場合は、ステータス バーを非表示にします。アプリがフォアグラウンドにあるときにすべてが行われます。
通知のコーディング:
Intent scheduledIntent = new Intent(context,Activity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, scheduledIntent, 0);
                nm = (NotificationManager) context
                        .getSystemService(Context.NOTIFICATION_SERVICE);
                CharSequence from = "From address";
                CharSequence message = "New Orders received";
                Notification notif = new Notification(R.drawable.icon,"Hai", System.currentTimeMillis());
                notif.setLatestEventInfo(context, from, message, pendingIntent);
                notif.flags |= Notification.FLAG_AUTO_CANCEL;
                nm.notify(uniqueID, notif);
                notif.ledOnMS = 500;
                notif.ledOffMS = 500;
このコードを通じて通知が受信されます。ただし、ステータス バーは常に表示されます。通知が届かないときは非表示にする必要があります。これを行う正しい方法を教えてください。
前もって感謝します、