The notification bar in my application shows only the small icon in the ticker (as it should). However, when the "shade" is pulled down, it shows both the small icon from the ticker, as well as a large icon that I set in the Notification.Builder. Here's my code:
if (Build.VERSION.SDK_INT > 10){
notification = new Notification(R.drawable.ic_stat_mintchip,
"This is a test",
System.currentTimeMillis());
notification.largeIcon = (((BitmapDrawable)c.getResources().getDrawable(R.drawable.ic_launcher)).getBitmap());
notification.defaults |= Notification.DEFAULT_ALL;
notification.number += 1;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
} else {
notification = new Notification(R.drawable.ic_stat_mintchip,
"This is a test",
System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_ALL;
notification.number += 1;
}
}
I don't quite know why this is happening. Any assistance?
By default, if you see a notification icon in the notification bar that you want to see more about, swipe down once from the top of your screen to expand your notifications.
1 Tap Notification Settings on the notification panel or tap the Settings app. 2 Tap Notifications. 3 Tap App icon badges.
Even if you don't get the gear icon when you swipe an Android Status Bar Icon notification, you can still turn off notifications for any app. Here's how: Go to Settings. Tap Notifications > App Settings.
Select the gear icon to go to the system settings. Now go to the “Display” settings. Look for “Display Size” or “Screen Zoom.” Slide the dot on the scale at the bottom of the screen to adjust the size.
I think the issue here is possibly that you're not using the Notificaiton.Builder class. Here's a small example of what you could do (you would have to insert your own variables though, and set the other properties that you used such as vibration):
Notification.Builder nb = new Notification.Builder(context)
.setContentTitle("title")
.setContentText("content")
.setAutoCancel(true)
.setLargeIcon(largeIcon)
.setSmallIcon(R.drawable.small_icon)
.setTicker(s.getText());
NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(100, nb.build());
Another issue i had in android lollipop is that the small icon was displayed next to the large icon. To solve it - just don't set the large icon! Use only the small icon setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With