离子推送 - 发送到外部 ID

Ionic push - send to external ids

在 IonicPush 的 alpha 版本中,可以将 pushNotifications 发送到 external_ids。然而,在测试版中,我只设法将 pushNotifications 发送到内部 ID。

external_id 连接到我的数据库中的用户,由我的后端生成,如下所示:55f743ed0664427a638c150c295741f8826994707148da4767

所以像这样在 alpha 中向 external_ids 发送 pushNotification 是没有问题的

user_ids: array("55f743ed0664427a638c150c295741f8826994707148da4767","55f743ed0664427a638c150c295741f8826994707148da4767","55f743ed0664427a638c150c295741f8826994707148da4767");

现在在测试版中,ionicPush 服务为每个用户生成 internal_ids,我只能将 pushNotifications 发送到 internal_ids。那些 internal_ids 没有保存在我的数据库中。

user_ids: array("5303434a-5f48-4743-9584-15ccb8bf7528","5303434a-5f48-4743-9584-15ccb8bf7528");

我现在的问题是我必须通过外部 ID 发送推送,但我不能再这样做了。 在我的例子中,发送有针对性的推送所必需的离子用户具有内部 ID、外部 ID 和名称。

更新:IonicUser

ionicUser 有名称、ID 和外部 ID。可以向 ID 发送推送,但不能向外部 ID 发送推送。

离子用户保存 Android/iOs 设备令牌

我不知道你所说的内部和外部 ID 是什么意思,但是当你使用代码时:

var push = new Ionic.Push({
  "debug": true
});

push.register(function(token) {
  console.log("Device token:",token.token);
});

它returns一个令牌。这是您可以保存到数据库的令牌,然后使用它发送通知,如下所述:http://docs.ionic.io/docs/push-sending-push.