我正在编写一个应用程序,您可以在其中创建并邀请多个用户参加活动。我想让应用程序在被邀请参加活动时向用户发送通知。我在按钮onClick方法中调用以下内容以在创建事件时发送通知。
private void addNotification() {
NotificationManager notif=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notify=new Notification.Builder
(getApplicationContext()).setContentTitle("Hello").setContentText("This is a notification").
setContentTitle("notif").setSmallIcon(R.mipmap.ic_launcher).build();
notify.flags |= Notification.FLAG_AUTO_CANCEL;
notif.notify(0, notify);
}
这有效,但是这只会在创建事件时向我发送推送通知。我不确定如何将它发送给邀请参加活动的多个人。我有一个我想要通知的用户电子邮件列表。如何更改此代码以向多个用户发送通知?
答案 0 :(得分:0)
为此您可以使用Google云消息传递。它将帮助您向多个用户广播通知
https://developers.google.com/cloud-messaging/android/client