I use this to add text when you swipe down a notification which gets refreshed once a minute using a timertask.
final NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
inboxStyle.setBigContentTitle("Expanded Details");
inboxStyle.addLine("• Get fruits.");
Timer updateTimer = new Timer();
updateTimer.schedule(new TimerTask()
{
public void run()
{
try
{
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss", Locale.GERMANY);
String curTime = format.format(new Date());
Date Date1 = format.parse(curTime);
Date Date2 = format.parse("23.08.2015 23:55:00");
long mills = Date1.getTime() - Date2.getTime();
int Hours = (int) ((mills / (1000*60*60)) % 24);
int Mins = (int) (mills / (1000 * 60)) % 60;
int Days = (int) (mills / (1000 * 60 * 60 * 24));
String diff = Days * -1 + " days, " + Hours * -1 + " hours and " + Mins * -1 + " minutes";
txtCurrentTime = diff;
mNotifyBuilder.setContentTitle(txtCurrentTime);
mNotifyBuilder.setContentText("until the time runs out.");
mNotifyBuilder.setStyle(inboxStyle);
mNotificationManager.notify(
notifyID,
mNotifyBuilder.build());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}, 0, 60000);
The problem is, when you swipe down the small notification ("until the time runs out") to see the expanded details, you are unable to get back to the small notification and need to restart the app. By now, you can only view the expanded details when you hold down the notification.
Is there a way to have this triggerable? Like when I swipe down it stays down as usual, but I can move it up again to have my small notification.