/// <summary> /// 极光推送V3版本 /// </summary> /// <param name="content"></param> public string PushV3(string content) { string app_key = ApiKey; string masterSecret = APIMasterSecret; string u_ = app_key + ":" + masterSecret;//对应推送 -u string base64_ = Encodebase64(u_);//编码 u_
StringBuilder sbs = new StringBuilder(); sbs.Append("{"); sbs.Append(""platform": "all","); sbs.Append(""audience": "all","); sbs.Append(""notification": {"); sbs.Append(""android": {"); sbs.Append(""alert": "" + content + "","); sbs.Append(""title": "武林国小","); sbs.Append(""builder_id": 1,"); sbs.Append(""extras": {"); sbs.Append(""newsid": 321"); sbs.Append("}"); sbs.Append(" },"); sbs.Append(""ios": {"); sbs.Append(""alert": "" + content + "","); sbs.Append(""sound": "default","); sbs.Append(""badge": "+1","); sbs.Append(""extras": {"); sbs.Append(""news_id": 134"); sbs.Append(" }"); sbs.Append(" }"); sbs.Append("},"); sbs.Append(""message": {"); sbs.Append(""msg_content": "" + content + "","); sbs.Append(""content_type": "text","); sbs.Append(""title": "武林国小","); sbs.Append(""extras": {"); sbs.Append(""key": "value""); sbs.Append("}"); sbs.Append("},"); sbs.Append(""sms_message":{"); sbs.Append(""content":"" + content + "","); sbs.Append(""delay_time":3600"); sbs.Append("},"); sbs.Append(""options": {"); sbs.Append(""time_to_live": 60,"); sbs.Append(""apns_production": true"); sbs.Append("}"); sbs.Append("}");
byte[] data = Encoding.UTF8.GetBytes(sbs.ToString());
//使用 HTTP Basic Authentication 的方式做访问授权//http Post方式调用极光的推送服务