From 7f8ba83aab3f00cc5fc19877d25334ad2331ab5f Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Mon, 7 Dec 2015 23:08:24 +0100 Subject: [PATCH] This might fix the missing progress bar #155 setVisibility(Public) is only available since Lollipop. --- .../nodomain/freeyourgadget/gadgetbridge/util/GB.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java index 1c055127..9ffa22f1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java @@ -51,14 +51,17 @@ public class GB { PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); - return new NotificationCompat.Builder(context) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setContentTitle(context.getString(R.string.app_name)) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context); + builder.setContentTitle(context.getString(R.string.app_name)) .setTicker(text) .setContentText(text) .setSmallIcon(R.drawable.ic_notification) .setContentIntent(pendingIntent) - .setOngoing(true).build(); + .setOngoing(true); + if (GBApplication.isRunningLollipopOrLater()) { + builder.setVisibility(Notification.VISIBILITY_PUBLIC); + } + return builder.build(); } public static void updateNotification(String text, Context context) {