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

Cannot set badge without also including a message_body #51

Closed
Atheros1 opened this issue Sep 1, 2016 · 1 comment
Closed

Cannot set badge without also including a message_body #51

Atheros1 opened this issue Sep 1, 2016 · 1 comment

Comments

@Atheros1
Copy link

Atheros1 commented Sep 1, 2016

But I don't want to include a message body, I just want to set the badge count. Use cases for this abound. Currently I've had to fork PyFCM and do like this:

from PyFCM.pyfcm import BaseAPI
import json
import config

base_service = BaseAPI(api_key=config.FCM_APIKey)

pushToken = "big-long-private-push-token-asdofiauusifaosdfuadfnua9sd8fnu9asd8f"
fcm_payload = dict()
fcm_payload['priority'] = 'high'
fcm_payload['notification'] = {}
fcm_payload['notification']['badge'] = 5
fcm_payload['to'] = pushToken
payload = (json.dumps(fcm_payload, separators=(',', ':'), sort_keys=True)
.encode('utf8'))

print base_service.send_request([payload])
@olucurious
Copy link
Owner

Can you kindly make a fix and submit a PR? It will be much appreciated

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