Update existing intent rather than replace it

For the use case of using the notification as a timer. If you update the
notification frequently, then tapping it would typically not resume the
app as the PendingIntent had been cancelled. Instead updates to the
notification now update the PendingIntent rather than replacing it, which
makes sense for most cases.
This commit is contained in:
Gearóid Moroney 2015-06-04 15:29:32 +01:00
parent cd1fb46dcc
commit 6d58038046

View File

@ -177,7 +177,7 @@ public class ForegroundService extends Service {
if (intent != null && settings.optBoolean("resume")) { if (intent != null && settings.optBoolean("resume")) {
PendingIntent contentIntent = PendingIntent.getActivity( PendingIntent contentIntent = PendingIntent.getActivity(
context, NOTIFICATION_ID, intent, PendingIntent.FLAG_CANCEL_CURRENT); context, NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setContentIntent(contentIntent); notification.setContentIntent(contentIntent);
} }