I want to write a little script that tells Firebase to push notification if a certain condition is met. How to send push notification from Firebase using google apps script?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- How can I force all files in a folder to be owned
- Listening to outgoing sms not working android
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I'd never tried this before, but it's actually remarkably simple.
There are two things you need to know for this:
Once you have read those two pieces of documentation, the code is fairly straightforward:
In this case:
the script sends a notification message. This type of message:
If you want full control over what the app does when the message reaches the device, send a data message
the script send the message to a specific device, identified by its device token in the
to
property. You could also send to a topic, such as/topics/user_TSR
. For a broader example of this, see my blog post on Sending notifications between Android devices with Firebase Database and Cloud Messaging.the
key
in theAuthorization
header will need to match the one for your Firebase project. See Firebase messaging, where to get Server Key?