Detecting failure of push.register()


#1

This might be trivial, but I can’t seem to figure out how to detect failure of push.register() - is there a straightforward way of doing this? I couldn’t find anything in the docs apart from the success callback (which receives the token).

Also, what would be the appropriate action on failure? Retry?


#2

To partially answer my own question, there seems to be an onError option for the Ionic.Push object:

$ionicPlatform.ready(function() {
  var push = new Ionic.Push({
    "debug": true,
    "onError": function() {
        ...
    }
  });

  push.register(function(token) {
    console.log("Device token:",token.token);
    push.saveToken(token);  // persist the token in the Ionic Platform
  });
});

I’m still not clear on the appropriate action for onError?