Reputation: 2069
I'm playing around notifications in android, and I'm wondering why NotificationCompat doesn't display Large Icon, and Number in Gingerbread as it does in Jellybean (see pics), I thought that was for that purpose that it was created ?
here is how I fire the notifications :
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnShow = (Button)findViewById(R.id.btnNotif);
Intent intent = new Intent(this, NotificationReceiverActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setWhen(System.currentTimeMillis())
.setContentText("You are near your point of interest.")
.setContentTitle("Proximity Alert!")
.setSmallIcon(android.R.drawable.ic_menu_info_details)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.orchide))
.setAutoCancel(true)
.setTicker("Proximity Alert!")
.setNumber(10)
.setContentIntent(pIntent)
.setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_VIBRATE| Notification.DEFAULT_SOUND);
/*Create notification with builder*/
notification=notificationBuilder.build();
/*sending notification to system.Here we use unique id (when)for making different each notification
* if we use same id,then first notification replace by the last notification*/
btnShow.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
notificationManager.notify(1000, notification);
}
});
}
Upvotes: 2
Views: 1913
Reputation: 683
Large icon is ignored on pre-honeycomb API levels.
NotificationCompat.Builder documentation says: ...On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect...
If you look at the NotificationCompat.Builder source you'll see that large icon is used for honeycomb and above.
Upvotes: 3