-1
Hello!
I’m learning notifications with flutter
and oneSignal
. I figured out how to send notifications to specific users, but I don’t know how to send them to multiple users. My code so far is this:
OneSignal.shared.postNotification(OSCreateNotification(
playerIds: ['e2926936-48d7-46c7-a093-169c19b902ee'],
content: 'Mensagem de teste',
heading: 'Acho que esta funcionando'));
In the playerIds
is where you put users to send. He expects a list, but searching the internet I saw that to send to all users just leave playerIds
empty. I tried this way and could not. I tried these ways: playerIds: []; playerIds: null; playerIds: [''];
, I also tried to delete the line, but from the exception all attempts
Anyway, I need you to send notification to all users at once
Oh yes, I had also read that you need a playerId, https://www.youtube.com/watch?v=HQ7sIhzQGNk, in this video here the Thizer App teaches how to use, and in one of the comments it says 'It’s supposed to work leaving the playerIds empty ;)' in answer the question: How do you send notification to everyone on the flutter?
– Jeff Henrique
I can send the notification through the Onesignal website, but I would like to send by application, in code you know
– Jeff Henrique
I believe that the only way will be getting all the playerID to send right?
– Jeff Henrique
I believe so. Won’t solve, but a tip that might help is you use the function
setExternalUserId
to associate a more meaningful key to each user.– Naslausky
Forgive the delay, as I did not work on the project these days, I ended up not even coming here, so I will study this externalUserId, I think will solve my problem, thank you
– Jeff Henrique