Notification listener rebinding

This commit is contained in:
James Babcock committed 2026-10-25 01:01:54 -07:00
1 parent 75e0b15d62
commit bf2addd287
6 files changed
+296 -68

No files matched your search

+6 -5
View File
@@ -1,4 +1,4 @@
import { isNotificationListenerEnabled, requestNotificationListenerAccess } from "../../native/notification-access";
import { notificationListenerState, requestNotificationListenerAccess } from "../../native/notification-access";
import { type AppDefinition } from "../app-definition";
import { createNotificationsAppWindow, NOTIFICATIONS_SURFACE_ID, NOTIFICATIONS_WINDOW_ID } from "./notifications-app";
@@ -7,10 +7,11 @@ const notificationsApp: AppDefinition = {
title: "Notifications",
icon: "bell",
launch: (ctx) => {
// Without notification-listener access the tray reads as empty; prompt
// the user on the phone so the on-glasses "grant permission" message is
// actionable. The app still opens to show that message.
if (!isNotificationListenerEnabled()) {
// Without notification-listener access (or with a listener Android won't
// rebind) the tray reads as empty; open the access screen on the phone so
// the on-glasses message is actionable. The app still opens to show it.
const listenerState = notificationListenerState();
if (listenerState === "no-access" || listenerState === "stuck") {
requestNotificationListenerAccess();
}
return ctx.launchInProcessApp(NOTIFICATIONS_WINDOW_ID, NOTIFICATIONS_SURFACE_ID, createNotificationsAppWindow);