Commit b1878598 authored by Helperhaps's avatar Helperhaps

android new feature

parent 161d274a
import jpush as jpush
from conf import app_key, master_secret
# from pprint import pprint
_jpush = jpush.JPush(app_key, master_secret)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
push.audience = jpush.all_
push.platform = jpush.all_
ios = jpush.ios(alert="Hello, IOS JPush!", badge="+1", sound="a.caf", extras={'k1':'v1'})
android = jpush.android(alert="Hello, Android msg", priority=1, style=1, big_text='jjjjjjjjjj', extras={'k1':'v1'})
push.notification = jpush.notification(alert="Hello, JPush!", android=android, ios=ios)
# pprint (push.payload)
result = push.send()
......@@ -76,7 +76,8 @@ def ios(alert=None, badge=None, sound=None, content_available=False,
payload['extras'] = extras
return payload
def android(alert, title=None, builder_id=None, extras=None):
def android(alert, title=None, builder_id=None, extras=None,
priority=None, category=None, style=None, big_text=None, inbox=None, big_pic_path=None):
"""Android specific platform override payload.
:keyword alert: String alert text.If you set alert to a empty string,then the payload
......@@ -95,6 +96,18 @@ def android(alert, title=None, builder_id=None, extras=None):
payload['title'] = title
if builder_id is not None:
payload['builder_id'] = builder_id
if priority is not None:
payload['priority'] = priority
if category is not None:
payload['category'] = category
if style is not None:
payload['style'] = style
if big_text is not None:
payload['big_text'] = big_text
if inbox is not None:
payload['inbox'] = inbox
if big_pic_path is not None:
payload['big_pic_path'] = big_pic_path
if extras is not None:
payload['extras'] = extras
return payload
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment