From b14997787da0589c6e2a01bd89c0a7ffdc8294d3 Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Thu, 9 Mar 2023 10:33:24 -0500 Subject: [PATCH] hide title when empty --- .../com/zinspector/foregroundservice/NotificationHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java b/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java index 2a68b74..eb22ff7 100755 --- a/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java +++ b/android/src/main/java/com/zinspector/foregroundservice/NotificationHelper.java @@ -107,13 +107,15 @@ Notification buildNotification(Context context, Bundle bundle) { checkOrCreateChannel(mNotificationManager, bundle); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID) - .setContentTitle(title) .setVisibility(visibility) .setPriority(priority) .setContentIntent(pendingIntent) .setOngoing(bundle.getBoolean("ongoing", false)) .setContentText(bundle.getString("message")); + if (!title.equals("")) { + notificationBuilder.setContentTitle(title); + } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { notificationBuilder.setColor(this.config.getNotificationColor());