fer
fer

Reputation: 87

Firebase pyfcm send push notification with an image

i am trying to send push notifications using Firebase and pyfcm https://pypi.python.org/pypi/pyfcm/. But i want to know how to send a image with the notification, because searching in the parameters there are no option

this is the documentation code of pyfcm:

def notify_multiple_devices(self,
                            registration_ids=None,
                            message_body=None,
                            message_title=None,
                            message_icon=None,
                            sound=None,
                            condition=None,
                            collapse_key=None,
                            delay_while_idle=False,
                            time_to_live=None,
                            restricted_package_name=None,
                            low_priority=False,
                            dry_run=False,
                            data_message=None,
                            click_action=None,
                            badge=None,
                            color=None,
                            tag=None,
                            body_loc_key=None,
                            body_loc_args=None,
                            title_loc_key=None,
                            title_loc_args=None,
                            content_available=None,
                            extra_kwargs={}):

so which parameter i should use to send an url image??

thanks

Upvotes: 3

Views: 5314

Answers (2)

Gaurav Nagpure
Gaurav Nagpure

Reputation: 126

There is a way to add image in notification area using PYFCM. extra_notification_kwargs allows us to add image in the notification.

we have to pass:

    extra_notification_kwargs = {
    'image':  #paste your notification image url here
    }

    notify_multiple_devices(.., 
    extra_notification_kwargs=extra_notification_kwargs)

similarly we can send to multiple devices also.

Upvotes: 9

Sibasish
Sibasish

Reputation: 356

There is no way to do with pyfcm.So you have to send a data payload like ex: {"url":"http://xyj.ss.png"} . In app you have to create a Notification​Service​Extension .In that you can modify the content of notice and download the image from server and display.

source : rich notification for ios 10

apple docs

Upvotes: -1

Related Questions