Can a single iOS application support multiple registration of input notifications?


This is the first time I go to the push notification service and I'm a little confused. I would like to have only some conceptual help, not code.
I need to create an application that needs to receive and register for different types of notifications. For example, in my application, I would like users to be able to register in the notification categories of the PROMO category and the NEWS notification category, I would like them to be able to choose which one they want to receive. Reading an Apple document, it was not so clear to me, it seems that as soon as the application is registered, I receive only one token and it seems impossible to get more tokens for different types of registration (for example, NEWS and PROMO), because the token is associated with application and device. It is right?
Another thing that is not so clear to me is that if a device is registered for a specific notification, is it possible to send a notification only to a set of devices?


If none of this is offered by Apple Push services, you think that you can work around this way: -I register a notification application if (PROMO || NEWS) is selected -I get a token -I send a token to my server, providing also additional information about the service that the user wants to subscribe -Server (provider) registers the token and type of subscription (PROMO || NEWS) -After I have a notification, I ask the server for all tokens registered for this particular category, and then I send a notification only to those devices Sites that are registered for this category.


Thanks for helping me, I'm really confused.

+1
source share
3 answers

"Reading an Apple document, it was not so clear to me, it seems that as soon as the application’s device is registered, I get only one token and it seems impossible to get more tokens for different types of registration (for example, NEWS and PROMO), because the token is connected with the app and device. Is this right? "

YES

Another thing that is not so clear to me is that if a device is registered for a specific notification, is it possible to send a notification only to a set of devices?

YES, you need a database where you connect a Push token with related services (promo | news). If you have a new Promo Push Message, you send a message to all associated tokens. on the application website, every time a user changes the category (promo / news), you must transfer this information to your service using an input token.

+5
source

These are all problems that you must solve yourself on the server side. The push service simply provides a means to send one message to one device. You need to find out what messages you want to send to which devices. Each message must be sent individually, there is no way to "broadcast" the message to all your users directly.

You could think of push address tokens as email addresses - of course, one email address can be subscribed to different newsletters from the same publisher, but this is the publisher’s task to find out to whom to send which newsletters, and not an email provider (Apple).

0
source

You should consider registering push notifications, for example, that I am sending user push notifications. Not that a push notification can be sent to the user.

Then you need to filter the servers by categories, for example, in your example promo and news .

User persistence must be stored on your server, so you will know what notification should be sent to the user.

0
source

Source: https://habr.com/ru/post/983600/


All Articles