I'd like to ask how it is possible to show text permanently in the notification bar?
The ticker set by the setTicker()
method disappears after a few seconds.
My goal is to show the current temperature in the notification bar. What would be the best solution to do this? Maybe there's a way to pass text to the setSmallIcon()
method?
Here's my notification code:
NotificationCompat.Builder notBuilder = new NotificationCompat.Builder(getApplicationContext());
notBuilder.setContentText("text");
notBuilder.setContentTitle("title");
notBuilder.setSmallIcon(android.R.color.transparent);
notBuilder.setTicker("ticker");
notBuilder.setOngoing(true);
int notID = 8;
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
nm.notify(notID, notBuilder.build());
(is there a better solution to hide the small icon? it's transparent this way but still takes up the place)
Thanks in advance!