-->

Send push notification to specific user?

2019-01-27 03:46发布

问题:

I'm making an app where I want to be able to set a basic notification (title, message, fire date) and have been trying to figure out the best way to setup the notifications. I'm working with Swift 3 and Firebase 3.

I don't want to use local notifications because if the user is logged in on multiple devices I want it to push to all those devices.

Is there a way to do this with FCM where a user can set a notification to fire at a specific date and time and have it fire on all (iOS) devices logged in?

If FCM doesn't have this, is there another APK that does? I've looked at Batch briefly but I'm already using Firebase.

Thanks in advance!

回答1:

If your main use case is to send a push notification to a single user for his multiple devices, I suggest you make use of Device Group Messaging on iOS. As per the docs, it is typically used for:

With device group messaging, app servers can send a single message to multiple instances of an app running on devices belonging to a group. Typically, "group" refers a set of different devices that belong to a single user.


When it comes to sending the notification on a specific date, I'm pretty sure you can set it up in the Firebase Console.

However, if you intend it to be sent from the server, you have to implement it yourself, since I think, there is no currently API available or a parameter you can set in the payload that can be modified for the message to be sent for a specific date.