I am developing an application in which I want to snooze the received notification automatically for 10 mins, if user didn't take any action (neither dismiss notification, nor opened the app) on the previously displayed notification. This is required in iOS
CodePudding user response:
You can't do that. Have you ever seen an app behave that way? No, because it's impossible (and incoherent).
Think of it this way. If the user does nothing, your app gets no signal that the notification fired. So it cannot "do" anything in response. You cannot respond to something that didn't happen.
Here's another way to look at it. When the notification fires, your app might not even be running. If the user does nothing, your app still won't be running. So how can it "do" anything?
In a comment, you referenced an app that has an "autosnooze" feature. But that app likely isn't snoozing in response to the fact that the user didn't do anything. It is scheduling a repeating notification (or multiple notifications) in advance, so the repetitions are already present when the user does nothing. When the user does respond, the app deletes the extra scheduled notifications. So you see, as I said before, the app responds to something that the user did do, not to something the user didn't do (though I can see why this behavior might give the illusion that it does what you asked to do).