且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

给特定 wordpress 用户的 FCM 通知

更新时间:2023-12-03 16:23:04

FCM 可以通过三种不同的定位方法发送通知:

FCM can send notifications with three different targeting methods:

  1. 到特定的 FCM 令牌/实例 ID 令牌,用于标识特定设备上特定应用程序的安装.
  2. 到一组此类设备/实例 ID.
  3. 到 FCM 客户可以订阅的特定主题.

Firebase Cloud Messaging 没有用户的概念,因此不能直接针对用户.如果您想定位用户,您必须将他们映射到上面列出的定位方法之一.

Firebase Cloud Messaging does not have the concept of a user, therefor it cannot target users directly. If you want to target users, you will have to map them to one of the targeting methods outline above.

我所知道的最常见的方式:

The most common ways that I know of:

  1. 将用户的令牌存储在其 UID 下的数据库中,然后在需要定位用户时发送到用户的令牌.
  2. 根据用户的 UID 为每个用户提供自己的主题.让应用订阅该主题,并在您需要定位用户时向用户的主题发送消息.

另见: