简体   繁体   中英

How can I trigger a push notification from a button clicked inside my app?

Simple question I think. I'm still fairly new to Swift and Firebase so bear with me.

My current set up

I successfully integrated Cloud Messaging and can send messages either through the testing function or with pre-created messages (scheduled or not).

My question

How can I trigger messages being sent, either pre-defined messages and if possible custom messages defined by the app and/or modified by eg user input? (For example: User presses button. Triggers message "xyz" to be sent to one specific other user, also predefined by the app.)

Any help would be greatly appreciated since I have not found a single thing that would help me understand this.

You can trigger an HTTP Request to send FCM message within your app!

https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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