[英]Is there a way to send FCM notification to a user data input in Firebase DB?
I'm creating a project where when the user enters his trade reuirements to the application its data gets saved in Firebase database. 我正在创建一个项目,当用户向应用程序输入其贸易需求时,其数据将保存在Firebase数据库中。 is there a way to send push notification this user's device when he enters the data in firebasedatabase using firebase push notifications
当该用户的设备使用firebase推送通知在firebasedatabase中输入数据时,有没有办法发送推送通知
You can do by this way,When user enter the data into the firebasedatabase. 您可以通过这种方式进行操作,当用户将数据输入基于Firebase的数据库中时。
On Response Successfully,You can set the value against that currently user in firebasedatabase user node. 在“成功响应”上,您可以在firebasedatabase用户节点中为该当前用户设置值。 Then using addValueListener of firebase database to check that value which you set if exist then create a push notification like this
然后使用firebase数据库的addValueListener来检查您设置的值(如果存在),然后创建这样的推送通知
NotificationManager notif=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notify=new Notification.Builder(getApplicationContext())
.setContentTitle(tittle)
.setContentText(body)
.setContentTitle(subject)
.setSmallIcon(R.drawable.abc)
.build();
notify.flags |= Notification.FLAG_AUTO_CANCEL;
notif.notify(0, notify);
After this set value to null after push notification. 推送通知后,将此值设置为null之后。
I hope its helpful for you! 希望对您有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.