Closed
Description
[REQUIRED] Step 2: Describe your environment
- Operating System version: 10.15.1 (19B88) Mac OS Catalina
- Firebase SDK version: 3.2.0
- Library version: 3.2.0 ?
- Firebase Product: Android Notification
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
- Try creating a notification with
sticky
=True for Android. - See that it throws a
ValidationError
Relevant Code:
android_config = messaging.AndroidConfig(
priority="high",
notification=messaging.AndroidNotification(
body=body,
title=title,
icon=icon, image=image, sticky=True
),
data=custom,
)
Throws
File "/home/vagrant/.local/lib/python2.7/site-packages/firebase_admin/messaging.py", line 117, in send
return _get_messaging_service(app).send(message, dry_run)
File "/home/vagrant/.local/lib/python2.7/site-packages/firebase_admin/messaging.py", line 355, in send
raise self._handle_fcm_error(error)
firebase_admin.exceptions.InvalidArgumentError: Invalid value at 'message.android.notification.sticky' (TYPE_BOOL), 1
Debugging shows:
firebase_admin._message_encoder.py
@classmethod
def encode_boolean(cls, value):
"""Encodes a boolean into JSON."""
if value is None:
return None
return 1 if value else 0