Skip to content

Commit 6606b29

Browse files
authored
Merge pull request #397 from DomiR/patch-1
feat(notification): allow passing of name and description
2 parents ccb6703 + 08dd06d commit 6606b29

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,11 +913,11 @@ private DfuServiceInitiator init(@Nullable final Uri fileUri,
913913
}
914914

915915
@RequiresApi(api = Build.VERSION_CODES.O)
916-
public static void createDfuNotificationChannel(@NonNull final Context context) {
916+
public static void createDfuNotificationChannel(@NonNull final Context context, @NonNull final String dfu_channel_name, @NonNull final String dfu_channel_description, boolean showBadge) {
917917
final NotificationChannel channel =
918-
new NotificationChannel(DfuBaseService.NOTIFICATION_CHANNEL_DFU, context.getString(R.string.dfu_channel_name), NotificationManager.IMPORTANCE_LOW);
919-
channel.setDescription(context.getString(R.string.dfu_channel_description));
920-
channel.setShowBadge(false);
918+
new NotificationChannel(DfuBaseService.NOTIFICATION_CHANNEL_DFU, dfu_channel_name, NotificationManager.IMPORTANCE_LOW);
919+
channel.setDescription(dfu_channel_description);
920+
channel.setShowBadge(showBadge);
921921
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
922922

923923
final NotificationManager notificationManager =
@@ -926,4 +926,9 @@ public static void createDfuNotificationChannel(@NonNull final Context context)
926926
notificationManager.createNotificationChannel(channel);
927927
}
928928
}
929+
930+
@RequiresApi(api = Build.VERSION_CODES.O)
931+
public static void createDfuNotificationChannel(@NonNull final Context context) {
932+
createDfuNotificationChannel(context, context.getString(R.string.dfu_channel_name), context.getString(R.string.dfu_channel_description), false)
933+
}
929934
}

0 commit comments

Comments
 (0)