diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2205c688..6716ea45 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -127,4 +127,8 @@
Update blocked
This update cannot be installed using the updater app. Please read %1$s for more information.
http://wiki.lineageos.org/upgrading.html
+
+ Export completion
+ New updates
+ Ongoing downloads
diff --git a/src/org/lineageos/updater/ExportUpdateService.java b/src/org/lineageos/updater/ExportUpdateService.java
index 6705de68..f05a7d11 100644
--- a/src/org/lineageos/updater/ExportUpdateService.java
+++ b/src/org/lineageos/updater/ExportUpdateService.java
@@ -15,6 +15,7 @@
*/
package org.lineageos.updater;
+import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
@@ -43,6 +44,9 @@ public class ExportUpdateService extends Service {
public static final String EXTRA_SOURCE_FILE = "source_file";
public static final String EXTRA_DEST_FILE = "dest_file";
+ private static final String EXPORT_NOTIFICATION_CHANNEL =
+ "export_notification_channel";
+
private volatile boolean mIsExporting = false;
private Thread mExportThread;
@@ -133,8 +137,14 @@ public class ExportUpdateService extends Service {
private void startExporting(File source, File destination) {
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+ NotificationChannel notificationChannel = new NotificationChannel(
+ EXPORT_NOTIFICATION_CHANNEL,
+ getString(R.string.export_channel_title),
+ NotificationManager.IMPORTANCE_LOW);
+ notificationManager.createNotificationChannel(notificationChannel);
- NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
+ NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,
+ EXPORT_NOTIFICATION_CHANNEL);
NotificationCompat.BigTextStyle notificationStyle = new NotificationCompat.BigTextStyle();
notificationBuilder.setContentTitle(getString(R.string.dialog_export_title));
notificationStyle.setBigContentTitle(getString(R.string.dialog_export_title));
diff --git a/src/org/lineageos/updater/UpdatesCheckReceiver.java b/src/org/lineageos/updater/UpdatesCheckReceiver.java
index b70d388f..9332bd92 100644
--- a/src/org/lineageos/updater/UpdatesCheckReceiver.java
+++ b/src/org/lineageos/updater/UpdatesCheckReceiver.java
@@ -16,6 +16,7 @@
package org.lineageos.updater;
import android.app.AlarmManager;
+import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
@@ -24,7 +25,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.preference.PreferenceManager;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.app.NotificationCompat;
import android.util.Log;
import org.json.JSONException;
@@ -46,6 +47,9 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
private static final String DAILY_CHECK_ACTION = "daily_check_action";
private static final String ONESHOT_CHECK_ACTION = "oneshot_check_action";
+ private static final String NEW_UPDATES_NOTIFICATION_CHANNEL =
+ "new_updates_notification_channel";
+
@Override
public void onReceive(final Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
@@ -121,7 +125,12 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
private static void showNotification(Context context) {
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context);
+ NotificationChannel notificationChannel = new NotificationChannel(
+ NEW_UPDATES_NOTIFICATION_CHANNEL,
+ context.getString(R.string.new_updates_channel_title),
+ NotificationManager.IMPORTANCE_LOW);
+ NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context,
+ NEW_UPDATES_NOTIFICATION_CHANNEL);
notificationBuilder.setSmallIcon(R.drawable.ic_system_update);
Intent notificationIntent = new Intent(context, UpdatesActivity.class);
PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
@@ -129,6 +138,7 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
notificationBuilder.setContentIntent(intent);
notificationBuilder.setContentTitle(context.getString(R.string.new_updates_found_title));
notificationBuilder.setAutoCancel(true);
+ notificationManager.createNotificationChannel(notificationChannel);
notificationManager.notify(0, notificationBuilder.build());
}
diff --git a/src/org/lineageos/updater/controller/UpdaterService.java b/src/org/lineageos/updater/controller/UpdaterService.java
index bfbb5d09..2c39502e 100644
--- a/src/org/lineageos/updater/controller/UpdaterService.java
+++ b/src/org/lineageos/updater/controller/UpdaterService.java
@@ -15,6 +15,7 @@
*/
package org.lineageos.updater.controller;
+import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
@@ -25,8 +26,8 @@ import android.content.IntentFilter;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
-import android.support.v7.app.NotificationCompat;
import android.text.format.Formatter;
import android.util.Log;
@@ -53,6 +54,9 @@ public class UpdaterService extends Service {
public static final String ACTION_INSTALL_UPDATE = "action_install_update";
public static final String ACTION_INSTALL_STOP = "action_install_stop";
+ private static final String ONGOING_NOTIFICATION_CHANNEL =
+ "ongoing_notification_channel";
+
public static final int DOWNLOAD_RESUME = 0;
public static final int DOWNLOAD_PAUSE = 1;
@@ -75,7 +79,13 @@ public class UpdaterService extends Service {
mUpdaterController = UpdaterController.getInstance(this);
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
- mNotificationBuilder = new NotificationCompat.Builder(this);
+ NotificationChannel notificationChannel = new NotificationChannel(
+ ONGOING_NOTIFICATION_CHANNEL,
+ getString(R.string.ongoing_channel_title),
+ NotificationManager.IMPORTANCE_LOW);
+ mNotificationManager.createNotificationChannel(notificationChannel);
+ mNotificationBuilder = new NotificationCompat.Builder(this,
+ ONGOING_NOTIFICATION_CHANNEL);
mNotificationBuilder.setSmallIcon(R.drawable.ic_system_update);
mNotificationBuilder.setShowWhen(false);
mNotificationStyle = new NotificationCompat.BigTextStyle();