def pushAPN(): push = IGeTui(HOST, APPKEY, MASTERSECRET) message = IGtSingleMessage() # APN旧版推送Demo # template = APNTemplate() # template.setPushInfo("", -1,"", "", "", "", "", "") # APN简单推送 template = APNTemplate() apn = APNPayload(); alertMsg = SimpleAlertMsg() alertMsg.alertMsg = "" apn.alertMsg = alertMsg apn.badge = 2 apn.sound = "" apn.addCustomMsg("payload", "payload") # apn.contentAvailable=1 # apn.category="ACTIONABLE" template.setApnInfo(apn) # APN高级推送 # template = APNTemplate() # apnpayload = APNPayload() # apnpayload.badge = 4 # apnpayload.sound = "sound" # apnpayload.addCustomMsg("payload", "payload") # # apnpayload.contentAvailable = 1 # # apnpayload.category = "ACTIONABLE" # # # alertMsg = DictionaryAlertMsg() # alertMsg.body = 'body' # alertMsg.actionLocKey = 'actionLockey' # alertMsg.locKey = 'lockey' # alertMsg.locArgs=['locArgs'] # alertMsg.launchImage = 'launchImage' # # IOS8.2以上版本支持 # # alertMsg.title = 'Title' # # alertMsg.titleLocArgs = ['TitleLocArg'] # # alertMsg.titleLocKey = 'TitleLocKey' # apnpayload.alertMsg=alertMsg # template.setApnInfo(apnpayload) # 单个用户推送接口 message.data = template ret = push.pushAPNMessageToSingle(APPID, DEVICETOKEN, message) print message print ret