Merge pull request #7462 from osmandapp/NotificationFailsFix
Fix ErrorNotification appearance
This commit is contained in:
commit
ed44959ede
2 changed files with 13 additions and 7 deletions
|
@ -191,9 +191,16 @@ public class NavigationService extends Service implements LocationListener {
|
|||
// registering icon at top level
|
||||
// Leave icon visible even for navigation for proper display
|
||||
Notification notification = app.getNotificationHelper().buildTopNotification();
|
||||
startForeground(OsmandNotification.TOP_NOTIFICATION_SERVICE_ID, notification);
|
||||
app.getNotificationHelper().refreshNotifications();
|
||||
return START_REDELIVER_INTENT;
|
||||
if (notification != null) {
|
||||
startForeground(OsmandNotification.TOP_NOTIFICATION_SERVICE_ID, notification);
|
||||
app.getNotificationHelper().refreshNotifications();
|
||||
return START_REDELIVER_INTENT;
|
||||
} else {
|
||||
notification = app.getNotificationHelper().buildErrorNotification();
|
||||
startForeground(OsmandNotification.TOP_NOTIFICATION_SERVICE_ID, notification);
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ public class NotificationHelper {
|
|||
all.add(downloadNotification);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Notification buildTopNotification() {
|
||||
OsmandNotification notification = acquireTopNotification();
|
||||
if (notification != null) {
|
||||
|
@ -56,10 +55,10 @@ public class NotificationHelper {
|
|||
if (notificationBuilder != null) {
|
||||
return notificationBuilder.build();
|
||||
} else {
|
||||
return buildErrorNotification();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return buildErrorNotification();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +67,7 @@ public class NotificationHelper {
|
|||
return downloadNotification.buildNotification(false).build();
|
||||
}
|
||||
|
||||
private Notification buildErrorNotification() {
|
||||
public Notification buildErrorNotification() {
|
||||
removeNotification(errorNotification.getType());
|
||||
setTopNotification(errorNotification);
|
||||
return errorNotification.buildNotification(false).build();
|
||||
|
|
Loading…
Reference in a new issue