dimanche 12 février 2017

ionic2 push get token

Vote count: 0

Is there a way to get the token outside the register method later in the code? I mean, is the token assigned to an attribute of the Push object somewhere?

  push.on('registration', (data) => {
    // console.log("device token ->", data.registrationId);
    //TODO - send device token to server
  });

The above code works to see the token, yet it is outside of my controllers or providers. I have to access it later in my code. I want to send the token to server, but for this I first have to get the user name. Since push registration happens somewhen when device ready, I yet do not have access to the user name. Another problem is for new users where token can not be assigned to a specific user yet and send device token to server can not be executed.

asked 37 secs ago

Let's block ads! (Why?)



ionic2 push get token

Aucun commentaire:

Enregistrer un commentaire