kawankoding / laravel-fcm

Firebase Cloud Messaging (FCM) sender for Laravel
172 stars 56 forks source link

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

Open olkotz opened 4 years ago

olkotz commented 4 years ago

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 commented 4 years ago
$fcm_token = User::select('fcm_token')
    ->where('id', $request->partner_id)
    ->first()
    ->fcm_token;

$respuesta = fcm()
    ->to([$fcm_token])
    // ...
olkotz commented 4 years ago

Thanks for answer so fast!!!

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

erlangparasu commented 4 years ago

@olkotz

have you added .env FCM_SERVER_KEY=yourkeyhere

then execute php artisan config:cache

?

erlangparasu commented 1 year ago

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