1 Star 0 Fork 0

supermay/CommLib.BdPush

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Notice_Android_Mod.cs 2.90 KB
一键复制 编辑 原始数据 按行查看 历史
supermay 提交于 2016-08-22 05:24 . 修改苹果的消息
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;
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/supermay/CommLib.BdPush.git
git@gitee.com:supermay/CommLib.BdPush.git
supermay
CommLib.BdPush
CommLib.BdPush
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385