Ionic Push can't have Android and iOS device tokens for one user

I have managed to setup my Ionic app so that when a user logs in, it stores their Android device tokens, or iOS device tokens on with their user id attached.

My problem is that when I open the app on the opposite device, it overwrites the existing token. So if I initially login on an iPhone, it will save that token and push notifications work fine. If I then login with an Android phone, it overwrites the existing iOS device token, and push notifications will only work on Android.

Is it possible to store both tokens at once?

I’m having the same issue, started working on the notification yesterday and was so hyped when I saw how easy it was with Android, and then came iOS… It was a chore to set up properly provisioning profiles & stuff but I finally got it to work and now I see that I can’t register a user with the same ID on both devices, why is that so ?

To be a bit clearer my app is only for people working in our company, so what I was thinking is to link the to the ID of the user in our DB, because it happens that one person has multiple devices… With this problem I can’t push notifications to those users.

Let me know if you found something, I’ll post if there is a workaround.

I’ve not found anything yet unfortunately

What I was thinking is to pull the id of my user and then concatenate the type of platform to it. That way I’ll have 2 users with the same name and when I want to do my CURL request to send the notifications I’ll target my users who have the id I want in the string of the Ionic id…

Kinda hackish but it’s the only thing I see working for now with the knowledge I have on the Ionic platform.

It seems absurd that users can’t have multiple devices though - which is why I was waiting for and hoped someone else would have a less hacky solution. That sounds like a good backup plan though!

I don’t know if it has changed yet, but they changed the way users works yesterday. I’m gonna work on it today to see if anything is different but maybe now we can bind different tokens to a users.

Also another thing, we are talking about having an android token & an iOS token for the same user but what if someone has a personnal android phone and a professionnal android phone, how would it work ?

Let me know how you get on, and if you notice any improvements to do with handling multiple devices on one account.

Yeah, users having multiple devices on the same OS is another issue. I can understand how/why that wouldn’t work though - if you look at the users on there is only room for an ios and android token. It baffles me how there is room for both an android/ios token but you can’t seem to use both of them.

Well I just got it to work again on Android. I ran the ionic run android multiples times (so it simulate multiple application PID) and I had different tokens for the same user so I guess it should be fine if I had an iOS token, I’m gonna work on it later today i’ll keep you updated

EDIT : It works with the new version of user authentication & push notification, I got both my iOS & Android token for the same user.

Hi ,can you share how you did to store device token for a user please? . Stuck on this for weeks! Grateful if you could help me