ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 208 forks source link

How can I send Big Picture Style notification with this? #247

Closed khurshid-alam closed 8 years ago

khurshid-alam commented 8 years ago

Is it possible to send big picture style notification with this?

image

eladnava commented 8 years ago

@khurshid-alam GCM's built-in notification support is limited to setting the notification title / body / icon and a few other properties, but not an image: https://developers.google.com/cloud-messaging/http-server-ref#downstream-http-messages-json

To display an image like the one you posted, you need to dispatch your own Notification using the Notification.BigPictureStyle, passing in the image like so: https://developer.android.com/reference/android/app/Notification.BigPictureStyle.html

You can send a link to download the image via GCM, have the device download it, read it into a Bitmap, and then display it using NotificationManager.

Good luck, and if you have any trouble, please consult StackOverflow. =)

govardhanaraoganji commented 8 years ago

yes @khurshid-alam, but @eladnava said was right and if you want you can do what ever you want. you need to override the Notification.

You need pass image URL as parameter in payload like body or data attributes and based on your logic Notification will display.

You need to take care about the image sizes, if it is big image notification looks ugly.