Background repeated Local Notification request

Hi,

 

How to handle Background Local Notification request from App Delegate. I am getting the notification once in console. but I need a repeated Notifications request that should trigger somewhere in the App Delegate file. But I could not get this trigger content from my code or in console. Please anyone help me on this. DidReceiveLocalNotification in Appdelegate also has no effect.

 

let content =  UNMutableNotificationContent()
            content.subtitle = subcontent
            content.title = NSString.localizedUserNotificationString(forKey: "Notification title", arguments: nil)
            content.userInfo =  descriptions 
            content.body = NSMutableString.localizedUserNotificationString(forKey: message, arguments: nil) 
            content.categoryIdentifier = Notification.WaitingIdentifiers.categoryWaiting 
            content.badge=0  
            content.sound = UNNotificationSound.init(named: "notification.mp3")

let center = UNUserNotificationCenter.current()
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 2, repeats:true )
                        

let request = UNNotificationRequest(identifier: indentifier, content: content, trigger: trigger)
       
        center.add(request, withCompletionHandler: {
            (errorObject) in 
            if let error = errorObject{
                print("Error (error.localizedDescription) in notification (indentifierreassign)")
            }else{ 
                print("Stage Coming only one time for repeated Notification")
            }
        })

Powered by WPeMatico

About

You may also like...

Comments are closed.