My application should run in full screen mode. And also i have to show notification bar when new items arrived to my app from our server. I write coding for notification in BroadcastReceiver class. i would like to make a decision in MainActivity like show the status bar only when new notification received otherwise hide the status bar. All are done when app is in foreground.
Coding for Notification:
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;
Through this code notifications are recieved. But the status bar is always visible. I need to hide when no notification received. Please provide me the right way to do this.
Thanks in advance,