Is it possible to send push notification with REST API on Firebase? I can send notifications with Firebase console but i need to send notifications with REST API.
相关问题
- 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
- Design RESTful service with multiple ids
- 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
We used the following documentation to send notifications from a web client.
There is an easy way to send a notification via Chrome App or Extension.
this may help - https://firebase.google.com/docs/cloud-messaging/http-server-ref where sample message you can find here - https://firebase.google.com/docs/cloud-messaging/downstream
from Firebase console you can get Server Key as an authorization you put in the http header, in the tab Cloud messaging.
I used the below rest API to send notification.
Authorization : key=AAAAG-oB4hk:APA91bFUilE6XqGzlqtr-M-LRl1JisWgEaSDfMZfHuJq3fs7IuvwhjoGM50i0YgU_qayJA8FKk15Uvkuo7SQtQlVt4qdcrrhvnfZyk_8zRGAskzalFUjr2nA2P_2QYNTfK6X8GbY0rni
where key is web_server_key from the console and you need to specify the unique registration key which you will get from the app.
"to": "ey_Bl_xs-8o:APA91bERoA5mXVfkzvV6I1I8r1rDXzPjq610twte8SUpsKyCuiz3itcIBgJ7MyGRkjmymhfsceYDV9Ck-__ObFbf0Guy-P_Pa5110vS0Z6cXBH2ThnnPVCg-img4lAEDfRE5I9gd849d" is the FCM registration token from device. Please refer to the below link.
https://firebase.google.com/docs/cloud-messaging/android/client?authuser=0
Just for helping,
If anyone wants to use REST POST API, here it is, use the Postman with below configuration
URL:
https://fcm.googleapis.com/fcm/send
Header:
BODY:
That's it. Thanks!!!
Using ARC For Sending Request to Firebase Console To Send Notification
You can use ARC OR Postman or your own server to send notification. You need to collect your web_server_key from the console and you need to specify the unique registration key which you will get from the app when calling the
onRefreshToken()
method.You need to send the request to https://fcm.googleapis.com/fcm/send with Content-Type : json and Authorization: web_server_key. On To value user your app_registration_token .