离子推送到Ionic.io的特定用户 [英] Ionic Push to specific user from Ionic.io

查看:137
本文介绍了离子推送到Ionic.io的特定用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从ionic.io实施离子推进。
向所有用户发送推送正在工作,但是向特定用户发送推送不起作用。
离子推送的代码如下:

I am trying to implemented ionic push from ionic.io. Sending push to all users are working, but sending push to a specific user is not working. The codes for ionic push are following as below:

function IonicPushInit(){
    var push = new Ionic.Push();    
    var callback = function(token) {     
      push.saveToken(token);
    }
    push.register(callback);
}

function IonicIoLogin(){
    var user = Ionic.User.current();

    if (user.isAuthenticated()) {                
        IonicPushInit();                

    } else {                                
        var details = {
          'email':  'asdsadsads@mail.com',
          'password': 'secretpassword'
        };
        var options = { 'remember': true };

        Ionic.Auth.login('basic', options, details).then(function(sucRes){                  
            IonicPushInit();                                    
        }, function(err){
            Ionic.Auth.signup(details).then(function(s){                        
                IonicPushInit();                        
            }, function(e){
                alert(e);
            });
        });
    }
}
IonicIoLogin();

执行上述代码后,当我从ionic.io向所有用户发送推送时,它可以正常工作。但是如果我向具有以下条件的特定用户发送推送,则它不起作用。

After execute above codes, when I send a push to all users from ionic.io, it works. But if I send a push to a specific user with following condition, it doesn't work.

所以我在用户中检查了用户asd ... @ mail.com选项卡,但在推选标签中是空的。这是什么原因?为什么它是空的?

So I've checked the user "asd...@mail.com" in User Tab, but in ther the push tab is empty. Is this the reason? Why it is empty?

上面的代码出了什么问题?

What's wrong with above the codes?

推荐答案

您的代码似乎很好,所以它必须是项目配置的东西。

Your code seems good, so it has to be something with project configuration.

您是否遵循离子文档使用完整设置?将令牌分配给真实用户不适用于有限设置=> http:// docs。 ionic.io/docs/push-full-setup

Did you follow ionic documentation to use "Full setup"? Assign tokens to real users does not work on "Limited setup" => http://docs.ionic.io/docs/push-full-setup

按照完全设置的步骤操作后,我遇到了问题。
然后我意识到寄存器在浏览器或模拟器中不起作用。你必须在真实设备上尝试它。

After follow steps of "Full setup" I had your problem. Then I realized that register doesn't work in browser or emulator. You have to try it on real device.

要获得有关注册功能的更多信息,请使用:

To have more information about your register function, just use:

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

这篇关于离子推送到Ionic.io的特定用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆