代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.HtmlControls;
using Newtonsoft.Json;
namespace CommLib.BdPush
{
public sealed class Notice_Android_Mod
{
//{
// "title" : "hello" ,
// "description": "hello world" //必选
// "notification_builder_id": 0, //可选
// "notification_basic_style": 7, //可选
// "open_type":0, //可选
// "url": "http://developer.baidu.com", //可选
// "pkg_content":"", //可选
// "custom_content":{"key":"value"},
//}
public string title { get; set; } //选填;通知标题,可以为空;如果为空则设为appid对应的应用名;
public string description { get; set; } //必填;同志文本内容,不能为空;
public int notification_builder_id { get; set; } //选填;android客户端自定义通知样式,如果没有设置默认为0;
public int notification_basic_style { get; set; }//选填;只有notification_builder_id为0时有效,可以设置通知的基本样式包括
//(响铃:0x04;振动:0x02;可清除:0x01;),这是一个flag整形,每一位代表一种样式;
public int open_type { get; set; } //选填: 点击通知后的行为(1:打开Url; 2:自定义行为;3:默认打开应用;);
public string url { get; set; } //选填;需要打开的Url地址,open_type为1时才有效;
public string pkg_content { get; set; }
//选填;open_type为2时才有效,Android端SDK会把pkg_content字符串转换成Android Intent,通过该Intent打开对应app组件,所以pkg_content字符串格式必须遵循Intent uri格式,最简单的方法可以通过Intent方法toURI()获取
public Dictionary<string,string> custom_content { get; set; } //选填:自定义内容,键值对,Json对象形式(可选);在android客户端,这些键值对将以Intent中的extra进行传递。
public Notice_Android_Mod(string title, string description)
{
this.notification_basic_style = 1;
this.custom_content = new Dictionary<string, string>();
this.custom_content.Add("custom_content", "custom_content");
this.title = title;
this.description = description;
}
public string toJson(string custom_content)
{
var result = JsonConvert.SerializeObject(this);
if (!string.IsNullOrEmpty(custom_content))
{
result = result.Replace("{\"custom_content\":\"custom_content\"}", custom_content);
}
return result;
}
public string toJson()
{
var result = toJson("");
return result;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。