I have a foreground service with a notification that I update every second as a timer. This works fine on my android 4.1 emulator. On a Galaxy Nexus phone the notification shows up as a new notification with a animation on each update. Why is that? Same android version, but I only found this behavior on Galaxy Nexus.
private void postNotification(Context context, int notificationId, String title, String text, String ticker, boolean service) {
Intent intent = new Intent(context, MyActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context, notificationId, intent, 0);
@SuppressWarnings("static-access")
NotificationManager nm = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setContentTitle(title);
builder.setContentText(text);
if(ticker.length() > 0)
builder.setTicker(ticker);
builder.setSmallIcon(R.drawable.notification);
builder.setContentIntent(contentIntent);
builder.setOngoing(service);
nm.notify(null, notificationId, builder.getNotification());
startForeground(notificationId, builder.getNotification());
}
It was another app that ran in the notification bar as a service that made this behavior. Worked after that app was uninstalled.