【问题标题】:iOS and Android push notifications with Meteor使用 Meteor 的 iOS 和 Android 推送通知
【发布时间】:2015-07-24 01:57:59
【问题描述】:

我在我的流星应用程序上安装了包“raix:push”。我希望它会询问应用程序的用户是否要接收推送通知,但事实并非如此。是否需要将某种代码添加到我的客户端/服务器文件中,以使其询问他们是否要接收推送通知?然后它会将数据发送给苹果和谷歌吗?我已经使用所有必要的键设置了我的配置文件。

【问题讨论】:

标签: android ios meteor


【解决方案1】:

要使用“raix:push”在应用程序中接收推送通知,如果使用“raix:push”版本 3(3),您还需要安装 Cordova npm 插件 phonegap-plugin-push。通过打开一个终端窗口并 cd 进入你的流星项目来做到这一点。然后输入下面的命令安装phonegap-plugin-push。 Meteor 需要精确版本的 Cordova 插件。

meteor add cordova:phonegap-plugin-push@1.5.2

【讨论】:

    【解决方案2】:

    我认为您应该创建一个函数来将此信息存储在 user.profile 文档中,而不是将其传递给推送通知的查询。类似的东西:

            function setUser(userId)
            {
              Meteor.users.update({_id: userId},{$set: {'profile.push_notifications': true}});
              return 1;
            }
    
    
    var arrayUsersIds = Meteor.users.find({"profile.push_notifications": true});
    
    sendPush(arrayUsersIds);
    
    
    function sendPushs(arrayUsersIds)
    
    Push.send({
            from: 'push',
            title: 'Hello',
            text: 'world',
            badge: 1, //optional, use it to set badge count of the receiver when the app is in background.
            query: {
                // Ex. send to a specific user if using accounts:
                 userId: {$in : arrayUsersIds} 
            }

    【讨论】:

      猜你喜欢
      • 2013-07-16
      • 2016-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-18
      • 2018-12-17
      相关资源
      最近更新 更多