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

do you know if this works with iphone device token and Firebase? #45

Open
olkotz opened this issue Jun 10, 2020 · 4 comments
Open

do you know if this works with iphone device token and Firebase? #45

olkotz opened this issue Jun 10, 2020 · 4 comments
Labels

Comments

@olkotz
Copy link

olkotz commented Jun 10, 2020

Hellow, first, thanks for share your work with us.

I dont have any response when i send notifications to an iPhone device. With php Curl the notifications works fine, but when i use FCM dosent send.

This is my code:

$fcm_token = User::select('fcm_token')->where('id',$request->partner_id)->first()->toArray();
$respuesta = fcm()
->to($fcm_token) // $recipients must an array
->priority('normal')
->timeToLive(0)
->data([
'sender_id' => intval($request->user_id),
'sender_name' => $user->name,
'type' => 'partner',
'date' => $request->date,
'shift' => $user->shift_id
])
->notification([
'title' => 'Test FCM',
'body' => 'This is a test of FCM',
])
->send();
->send();

And the return of json_encode($respuesta) is {}

Thanks again!!

@erlangparasu
Copy link
Collaborator

erlangparasu commented Jun 10, 2020

$fcm_token = User::select('fcm_token')
    ->where('id', $request->partner_id)
    ->first()
    ->fcm_token;

$respuesta = fcm()
    ->to([$fcm_token])
    // ...

@olkotz
Copy link
Author

olkotz commented Jun 10, 2020

Thanks for answer so fast!!!

still return {} with the changes that you propose....

@erlangparasu
Copy link
Collaborator

erlangparasu commented Jun 12, 2020

@olkotz

have you added .env
FCM_SERVER_KEY=yourkeyhere

then execute
php artisan config:cache

?

@erlangparasu
Copy link
Collaborator

Hi, @olkotz .. maybe you can try to enable debug response. then check the firebase log in the laravel.log file.

fcm()
    ->to($recipients)
    // ...
    ->enableResponseLog()
    ->send();

if you like, please share the response log here so we can see the problem

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

No branches or pull requests

2 participants