NET SDK
github 地址 https://github.com/yeanzhi/XinGePushSDK.NET 傳送門
如何安裝
- 建議使用nuget安裝包,搜索“信鴿”即可
- 可以通過clone源碼編譯出dll文件後引入。注意項目使用vs2013
Restful api接口說明
詳細說明請瀏覽信鴿官方wiki[傳送門][1]使用教程
1,初始化信鴿推送
XingeApp xinge = new XingeApp("accessId", "secretKey");
2,新建消息
2.1 IOS消息
Payload pl = new Payload("這是一個簡單的alert");
Msg_IOS mios = new Msg_IOS(pl);
2.2 android消息(這裏使用透傳消息做演示,更多內容查看源碼中Msg目錄下消息類)
Msg_Android mandroid = new Msg_Android_TouChuan("測試", XinGeConfig.message_type_touchuan)
{
content = "測試"
};
3,使用XingeApp推送消息。注:上方函數android,下方爲ios
3.1Push消息(包括通知和透傳消息)給單個設備
xinge.PushToSingleDevice("DeviceToken", mandroid);
xinge.PushToSingleDevice("DeviceToken", mios, XinGeConfig.IOSENV_DEV);
3.2Push消息(包括通知和透傳消息)給單個賬戶或別名
xinge.PushToAccount("account", mandroid);
xinge.PushToAccount("account", mios, XinGeConfig.IOSENV_DEV);
3.3Push消息(包括通知和透傳消息)給多個賬戶或別名(批量推送)
xinge.PushAccountList(new List<string>() { "account1" ,"account2"}, mandroid);
xinge.PushAccountList(new List<string>() { "account1", "account2" }, mios, XinGeConfig.IOSENV_DEV);
3.4Push消息(包括通知和透傳消息)給app的所有設備
xinge.PushAllDevice(mandroid);
xinge.PushAllDevice(mios,XinGeConfig.IOSENV_DEV);
3.5Push消息(包括通知和透傳消息)給tags指定的設備
xinge.pushTags(new List<string>() { "tag1", "tag1" }, "OR", mandroid);
xinge.pushTags(new List<string>() { "tag1", "tag1" }, "OR", mios, XinGeConfig.IOSENV_DEV);
3.6查詢羣發消息發送狀態
xinge.QueryPushStatus(new List<string>() { "pushId1", "pushId1" });
3.7查詢應用覆蓋的設備數
xinge.QueryDeviceCount(new List<string>() { "pushId1", "pushId1" });
3.8查詢應用的Tags
xinge.QueryTags(0, 100);
3.9取消尚未觸發的定時羣發任務
xinge.CancelTimingPush("pushId1");
3.10批量設置標籤
var tags = new Dictionary<string, string>();
tags.Add("tag1", "token1");
xinge.BatchSetTag(tags);
3.11批量刪除標籤
xinge.BatchDelTag(new List<string>() { "tag1", "tag2" });
3.12查詢應用某token設置的標籤
xinge.QueryTokenTags("deviceToken");
3.13查詢應用某標籤關聯的設備數量
xinge.QueryTagTokenNum("tag");