How to trigger remote push notification when Firebase node database values ​​are changed for a user in Swift for iOS development using Batch?

I am using the Firebase database for my iOS Swift application. After going through the amount of material on the Internet, I decided to try Batch + Firebase to provide remote push notifications to the registered user with authentication in the application when the node values ​​in his / her database change. I save the registered user id like this:

override func viewDidLoad(){ super.viewDidLoad() //... editor = BatchUser.editor editor.setIdentifier("uid" as String!) editor.save() } 

Of course, I did the necessary background work to enable push notifications for my application. In addition, both Firebase and Batch containers were installed, and I force the user to activate the notification settings.

I am not sure how to write the modified database values ​​to the push notification and deliver to the user. I have searched many times for relevant textbooks online, but to no avail.

Any guidance on implementing the batch APIs in Swift for Firebase is welcome.

+6
source share
1 answer

If you want to send push notifications directly from the application (users to users), you will need to use the batch transaction API with custom_ids (Firebase UID) in the recipient list instead of push tokens.

You need to learn how to call the REST API from Swift code.

Here is a tutorial: http://www.kaleidosblog.com/nsurlsession-in-swift-get-and-post-data

0
source

All Articles