Reputation: 4931
This is my code:
Notification n = new Notification();
n.icon = R.drawable.ic_launcher;
n.tickerText="test";
n.defaults |= Notification.DEFAULT_ALL;
Intent dummyIntent = new Intent();
dummyIntent.setAction("dummy");
PendingIntent pi = PendingIntent.getBroadcast(c, 0, dummyIntent, 0);
n.setLatestEventInfo(c, "test","test", pi);
NotificationManager nm = (NotificationManager)c.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(1, n);
I want to put this as notifications not as onGoing. But this Notification is indicated as onGoing? Why?
Upvotes: 1
Views: 180
Reputation: 6200
You can Build Notifications on this way, this is the new method for creating Notifications and let you customize them better than the old one as you can see here and here.
NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationBuilder = new NotificationCompat.Builder(mContext);
notificationBuilder.setContentTitle("Title")
.setContentText("Text")
.setSmallIcon(R.drawable.icon)
.setContentIntent(contentIntent)
.setOngoing(false)
.setTicker("Ticker Text");
With setOngoing()
you can set it to true
or false
.
Upvotes: 2