Post

Replies

Boosts

Views

Activity

Reply to Notification Permission Issue in Device Activity Report Extension (iOS 26)
Function call: showNotification( title: "Screen Time", body: "Time: (Date().formatted(.dateTime.hour().minute().second()))", timeInterval: 1, isTimeSensitive: true ) Code: func showNotification(title: String, body: String, timeInterval: Double, isTimeSensitive: Bool, widgetName: String? = nil, pageIndex: Int? = nil) { UNUserNotificationCenter.current().getNotificationSettings { settings in if settings.authorizationStatus == .authorized { let content = UNMutableNotificationContent() content.title = title content.body = body content.sound = UNNotificationSound.default // Add category identifier for tap handling content.categoryIdentifier = "ULTRAMIND_NOTIFICATION" // Add user info for navigation context if provided if let widgetName = widgetName, let pageIndex = pageIndex { // pageIndex: 0 = HomeTab, 1 = LeftBrain tab, 2 = HomeTab (main), 3 = RightBrain tab // widgetName: identifier for which bottom sheet to open (lowercase) content.userInfo = [ "widgetName": widgetName.lowercased(), // Convert to lowercase "pageIndex": pageIndex ] } if(isTimeSensitive){ content.interruptionLevel = .timeSensitive } let trigger = UNTimeIntervalNotificationTrigger(timeInterval: timeInterval, repeats: false) let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger) UNUserNotificationCenter.current().add(request) { error in if let error = error { // print("Error showing termination notification: \(error)") } } } } }
Topic: App & System Services SubTopic: General Tags:
4d