Push get Token

Is there a way to get the token outside the registration event 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 log 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 because my user service is not initialised. 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.

Do you have any solution?

Can you describe more what specifically you’re struggling with? OP seems to have been generally unclear on the concept of asynchronous JavaScript.

We have changed the owner of our app
Since (I don’t know if it’s related) old users in the system do not receive notifications
I thought maybe we should manually update their token

Yeah, I would definitely open a new thread for that issue.