-
Notifications
You must be signed in to change notification settings - Fork 23
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
CouldNotSendNotification thrown even when notification was sent successfully #4
Comments
show your code in routeNotificationForFCM |
@enniel It has a comma separated list of tokens. Any info if you have to sent notification to n devices of a single user? |
Any update? |
Show your code in routeNotificationForFCM and your notification file. I need to test your code. |
Notification File:
|
You tryed array of tokens? public function routeNotificationForFCM()
{
return PushToken::where('user_id', $this->id)->pluck('token')->toArray();
} |
Sadly, that didn't help either.
|
You used routeNotificationForFCM or routeNotificationForFcm method? |
Tried w/ both. Didn't work. Still the same. |
You can show output from |
I'm tried send notification and all works: // notifiable model
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function routeNotificationForFCM() {
return ['fYuuanS_YK4:APA91bEsFBKF3cUXotoxvOv2S9kyss9V3ONQZUuDq8cBvm57AuXdJn6SB3sY5JMpe0lLJUPk4D7c8bWTtPLRkwykJNtnazNMmBbo8eoU8mctiTZXf5XvN_lA_h7Mf9o2AUg9gMBgfmKG'];
}
} // notification
<?php
namespace App\Notifications;
use NotificationChannels\FCM\FCMMessage;
use Illuminate\Notifications\Notification;
class ExampleNotification extends Notification
{
public function via($notifiable)
{
return ['fcm'];
}
public function toFCM($notifiable)
{
return (new FCMMessage())
->notification([
'title' => 'Notification title',
'body' => 'Notification body',
]);
}
} // send notififications
Notification::send(User::all(), new ExampleNotification()); |
This is so weird. Only two things different is queue able and that try catch block. |
Maybe public function routeNotificationForFCM() {
return PushToken::where('user_id', $this->id)->whereNotNull('token')->pluck('token')->toArray();
} |
You can show your notifiable model code? |
Its mostly the same as you have. However, I'm initiating the notification in model boot function.
|
Show please User model |
|
public function routeNotificationForFCM()
{
return PushToken::where('user_id', $this->id)->pluck('token')->toArray();
} |
Yes. This isn't the updated code. I'm at office as of now this is the
earlier commit. But I assure you the function is the same as you mentioned
here.
On Fri 19 May, 2017, 12:44 PM Evgeni Razumov, ***@***.***> wrote:
public function routeNotificationForFCM() { return PushToken::where('user_id', $this->id)->pluck('token')->toArray(); }
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABuiLy9FMt5I62K_VGaFVUWNoHC56fnZks5r7UFEgaJpZM4NaL_6>
.
--
Tushar Deo
http://tusharvikky.github.io/
|
|
@enniel Any update? |
Could you please try with this code:
|
@bayuly94 have you solved your issue? How? |
Hello,
"Notification was not sent. You should specify device token(s), topic(s) or group(s) for sending notification."
However,
laravel-fcm.log
logs[2017-05-13 20:37:29] Laravel-FCM.INFO: notification send to 1 devices success: 1 failures: 0 number of modified token : 0 [] []
and the push notification was successfully delivered.The text was updated successfully, but these errors were encountered: