I am trying to create an app which will require more than 64 local notifications. Is there any way of triggering code when the system delivers a notification to the user without the user interacting with the notification?
问题:
回答1:
Yes and no.
If the notification is delivered when the app is in the foreground, it is delivered to you (the app), not to the user, so you will know in that way.
If is delivered when the app is not in the foreground, the app is not running so there is no one to tell. The app is not going to launch / wake you just to tell you that the notification took place. As you rightly imply, if the user asks the notification to contact you, you will be contacted, but otherwise, no.
However, you get an event when the app comes to the front once again, so you can always look to see whether the notification time happened "while you were out".
(Also note that the notification might never be delivered to the user. The user can just turn off notifications. It is risky to rely on them completely.)