简体   繁体   English

如何控制收到的Apple Push Notifications

[英]How can I control the Apple Push Notifications I receive

I have successfully created a server that sends Apple Push Notifications, and my iphone receives them. 我已经成功创建了一个发送Apple Push Notifications的服务器,我的iPhone收到了它们。

For example I have Notification of type A and notifications of type B, 例如,我有A型的通知和B型的通知,

How can I control the types of notifications I received on the iphone side? 如何控制在iphone端收到的通知的类型? For example I only want type A and not B (Just like Facebook, I want notifications for Friend Request, but not for Walls) 例如,我只想输入A,而不是B(就像Facebook,我想要通知Friend Request,而不是Walls)

Thanks 谢谢

you cannot stop your device on receiving a specific type of notification unless it is done on server side. 除非在服务器端完成,否则您无法停止设备接收特定类型的通知。 Though you can ignore a notification when app is in running state as you get the notification in didReceiveRemoteNotification and you can simply ignore it after checking it but if app is in background or it is closed then you cannot control the incoming notifications from within your app. 尽管当您在didReceiveRemoteNotification获得通知时,您可以忽略应用程序处于运行状态时的通知,并且可以在检查通知后将其忽略,但是如果应用程序处于后台或关闭状态,则您将无法从应用程序内部控制传入的通知。

you can make a service on server to set preferences for notification types. 您可以在服务器上提供服务以设置通知类型的首选项。 from device, user can enable/disable the push service for individual features and update the preferences on server from device. 通过设备,用户可以启用/禁用单个功能的推送服务,并通过设备更新服务器上的首选项。

On server, before sending the PUSH, you can check for the preferences selected by user from the table and send only those notifications which the user has opted for. 在服务器上,在发送“推”之前,您可以检查用户从表中选择的首选项,并仅发送用户选择的那些通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM