IOS Push Notification disable/enable on the basis

2019-12-16 19:52发布

问题:

  1. Just wondering whether there is any way to disable/enable a push notification when it is received.

    For e.g :- When i receive a push notification then i first check in my app whether in notification setting i have enabled or disabled the notification.

  2. There can also be multiple notification settings like

    • To disable a friend request notification
    • To disable message notification

So while sending a notification is there any way to append notificationType like if its for friend request or messaging.

Then after checking the notification type and its corresponding setting in the app, showing or discarding the notification.

回答1:

You can't achieve this just in client side itself. Because once notification arrives it is handled by iOS and displayed in notification centre (or any other type as per user setting). App will not get the notification info, unless it is running.

You can have this as settings in Client and sync it with server to have a check there before pushing the notifications.