• Well that's interesting... I know things like Google Maps notifications don't normally show up because they're treated as 'Local' notifications... I don't know if the developer could just do that?

    But also, maybe I'm wrong here but I was pretty sure that just 'modifying' a notification didn't push the changes to Bangle.js. Is it possible the developer is dismissing the old notification and creating a new one rather than just doing https://developer.android.com/develop/ui/views/notifications/build-notification#Updating ?

  • Yeah, that's actually what I suggested to the AntennaPod devs on GitHub - specifying "setLocalOnly(true)" on the download and service notifications.

    The counterpoint I was given is that folks may want to see download progress on other devices. And with setAlertOnlyOnce(true) as documented on the page you linked to, presumably Gadgetbridge and/or Bangle.js should not be repeatedly showing the notification, only updating it.

    From what I can tell, AntennaPod does reuse the notification ID to update the notification (rather than deleting and recreating)…

    There is updateNotifications(), which is called by NotificationUpdater which specifies a fixed notification ID:

        private class NotificationUpdater implements Runnable {
            public void run() {
                Notification n = notificationManager.updateNotifications(downloads);
                if (n != null) {
                    NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                    nm.notify(R.id.notification_downloading, n);
                }
            }
        }
    

    (This notification ID and others are defined in the resources.)

    Based on code elsewhere in the same file, this notification is updated once a second:

        /**
         * Schedules the notification updater task if it hasn't been scheduled yet.
         */
        private void setupNotificationUpdaterIfNecessary() {
            if (notificationUpdater == null) {
                Log.d(TAG, "Setting up notification updater");
                notificationUpdater = new NotificationUpdater();
                notificationUpdaterFuture = notificationUpdateExecutor
                        .scheduleAtFixedRate(notificationUpdater, 1, 1, TimeUnit.SECONDS);
            }
        }
    
About

Avatar for Gordon @Gordon started