我尝试使用一个信号,fcm,但我必须手动定位我想发送通知的人,但情况并非如此。每次用户向特定餐厅而不是所有餐厅下订单时,都应自动触发通知。
一个信号,FCM,推杆梁,按钮警报
public class MyService extends FirebaseMessagingService {
/**
* Called when message is received.
*
* @param remoteMessage Object representing the message received from Firebase Cloud Messaging.
*/
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
// TODO(developer): Handle FCM messages here.
// If the application is in the foreground handle both data and notification messages here.
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated. See sendNotification method below.
RemoteMessage.Notification notification = remoteMessage.getNotification();
Map<String, String> data = remoteMessage.getData();
sendNotification(notification, data);
}
预期结果是通知应仅发送给目标餐厅,而不是所有其他餐厅。 实际结果是我必须手动触发才能从用户应用程序发送到特定餐厅,这在应用程序开发方面是不合适的
听起来你正在寻找有关如何将后端事件与OneSignal集成的信息。您可以使用我们的 API 来实现此目的。看看我们的博客文章,解释如何实现你想要的结果。