From 4826dbcc3489c339445fb8f8cf61e6bbb35e3d05 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Sat, 12 Oct 2013 15:04:16 +0200 Subject: [PATCH] Upgrade notification KeyCachingService code to NotificationCompat.Builder --- .../thoughtcrime/securesms/service/KeyCachingService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/service/KeyCachingService.java b/src/org/thoughtcrime/securesms/service/KeyCachingService.java index 7422ad0d3e..e24026c9e6 100644 --- a/src/org/thoughtcrime/securesms/service/KeyCachingService.java +++ b/src/org/thoughtcrime/securesms/service/KeyCachingService.java @@ -189,7 +189,7 @@ public class KeyCachingService extends Service { } private void foregroundServiceModern() { - Notification notification = new Notification(R.drawable.icon_cached, null, System.currentTimeMillis()); + NotificationCompat.Builder builder = new NotificationCompat.Builder(this); RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.key_caching_notification); Intent intent = new Intent(this, KeyCachingService.class); @@ -197,10 +197,11 @@ public class KeyCachingService extends Service { PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent, 0); remoteViews.setOnClickPendingIntent(R.id.lock_cache_icon, pendingIntent); - notification.contentView = remoteViews; + builder.setSmallIcon(R.drawable.icon_cached); + builder.setContent(remoteViews); stopForeground(true); - startForeground(SERVICE_RUNNING_ID, notification); + startForeground(SERVICE_RUNNING_ID, builder.build()); } private void foregroundServiceLegacy() {