xtrinch / fcm-django

FCM Django: Send push notifications via django to websites, iOS & android mobile devices through FCM (Firebase Cloud Messaging)
http://fcm-django.readthedocs.io/
MIT License
775 stars 196 forks source link

Send rich notifications in iOS #13

Closed monicaphalswal closed 7 years ago

monicaphalswal commented 7 years ago

I'm not able to send "mutable_content": True in extra kwargs as an additional keyword argument (which is required to send rich notifications to iOS). I am getting notify_single_device() got an unexpected keyword argument 'mutable_content' error. I looked in PyFCM documentation, it supports this field in additional arguments. Please help.

monicaphalswal commented 7 years ago

Please reply. Is this an issue with fcm-django because I was able to send this key with pyFCM?

xtrinch commented 7 years ago

How are you passing kwargs and which version of pyfcm and fcm-django library are you using?

self-maurya commented 7 years ago

c9e4bad @monicaphalswal check this commit, I think you're using older version of PyFCM

monicaphalswal commented 7 years ago

The version info is as below for the two packages: Name: pyfcm Version: 1.2.9

Name: fcm-django Version: 0.2.7

kwargs = {
        'content_available': True,
        'time_to_live': 30,
        'mutable_content': True
    }

devices.send_message(
            title="Name", 
            icon="appicon",
            data={
                "notification type" : 2,
            },
            **kwargs
        )

I am getting error: TypeError: notify_single_device() got an unexpected keyword argument 'mutable_content'

xtrinch commented 7 years ago

On a second look, there actually is no mutable content as a keyword argument in that function, so you should be passing it in an 'extra_kwargs' dict in 'kwargs'.

For example:

kwargs = { extra_kwargs = { mutable_content: True } }

Let me know if that works for you.