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 an Image through notification or data message type? #31

Open
gunalan87 opened this issue Sep 18, 2018 · 1 comment
Open

Comments

@gunalan87
Copy link

I have tried the following code.

$message = new Message();
$message->setPriority('high');
$message->addRecipient(new Device('DEVICE_TOKEN'));
$message
->setNotification(new Notification('Notification Title', 'Notification Body',"Image_URL"));
//->setData(['key' => 'value']);
$response = $client->send($message);

@redjanym
Copy link

You can use this method to set the icon of the notification:

// android only, set the name of your drawable resource as string
$message->setIcon('name');

Or if you just want to send an image url and then capture it on client side you can send it as Data.

$notification->setData(['image_url' => 'absolute_path_of_image'])

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

2 participants