Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send all device that have my app installed? #39

Open
syahnur197 opened this issue May 5, 2019 · 3 comments
Open

How to send all device that have my app installed? #39

syahnur197 opened this issue May 5, 2019 · 3 comments

Comments

@syahnur197
Copy link

So far what I understand this package can help me to send notification to specific user(s). So we need to query all the users in the db and send the notification individually to them. My problem right now is, I want to send FCM notification to all devices that installed my app. How can I do that in Laravel?

I tried on demand notification but it didn't work

Notification::(new PromotionNotification($promotion));

Using the method above, I need to chain with route()

Notification::route('fcm', 'insert device token here')->notify(new InvoicePaid($invoice));

However, this is not what I want to achieve, since I need to specify the users again to use the above method.

@PeterDanielso
Copy link

Hello, im trying to reach similar behaviour.
As far as i know, notifications have options to send notifications to many users with something like this:

$users = User::whereHas('if_your_user_has_device_fcm_tokens_logic')->get();
Notification::send($users, new YourFcmNotification($anyData));

Maybe something like that fit our requirements sending notifications to all users who have installed the app and also enabled to send token to your server.

@flexgrip
Copy link

No, from the cloud messaging console, we can choose an app as a target. Like, "Send to all iOS". So there must be a similar way to do it via the api... just may not be implemented in this package.

I see that you can send via a topic. I'll dig through it and see if there's a way to send to a targeted app.

@PeterDanielso
Copy link

Okey, thanks for explanation. That would have less impact on laravel server same as when broadcasting client messages. I will be looking for news, glad to improve things if need help.

On our personal case we need some kind of syncro, i mean, when we send fcm notifications we also clone it to laravel and later we link the fcm url to that laravel notification then users do actions with them (mark them read bla bla).

Hope my english is understandable. Have good day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants