Giter VIP home page Giter VIP logo

baidu.sdk.push's Introduction

Baidu.SDK.Push(百度推送SDK C#版本)

百度推送C#版本SDK,包括了公开 REST API 的所有功能。 限于开发资源等原因,IOS相关API未作测试。

基本功能,如推送消息,TAG相关已在生产环境部署使用。

Usage

Configuration

在Console或者Winform程序中,添加或者修改您的App.config文件,添加或者修改如下配置节, 在Web项目中,在Web.config文件中,添加或者修改如下配置节:

<appSettings>
	<add key="ApiKey" value="百度推送中对应应用分配的APIKey"/>
	<add key="SecretKey" value="百度推送中对应应用分配的SecretKey"/>
</appSettings>

Promgrame

using System.Configuration;
using Baidu.SDK.Push;
using Baidu.SDK.Push.Dto;

namespace YourNameSpace
{
	public class YourClass
	{
		// Read APIKey and SecretKey from config file, you can store them by other method
		// 从配置文件中读取APIKey以及SecretKey,也可以根据项目需要使用其他方式存储
		private readonly string _apiKey = ConfigurationManager.AppSettings["ApiKey"];
		private readonly string _secretKey = ConfigurationManager.AppSettings["SecretKey"];

		public void YourMethod()
		{
			var messageList = new List<string>
			{
				Guid.NewGuid().ToString()
			};
			var messageKeyList = new List<string>
			{
				Guid.NewGuid().ToString()
			};
			var request = new MessagePushBroadcastRequest(
            DeviceTypes.Android,
            MessageTypes.Message,
            messageList,
            messageKeyList
            );
			
			var pushService = new Client(_apiKey, _secretKey);
			var response = pushService.PushMessageBroadcast(request);
		}
	}
}

Installation

Use Source Code

编译Baidu.SDK.Push\Baidu.SDK.Push.csproj文件,在项目中使用生成的文件。

Use Nuget

先检查是否安装了 NUGET程序包管理器 扩展,如果未安装,请先安装。

项目上右击,点击 项目的管理Nuget程序包(N) 菜单,进入联机,搜索 Baidu.SDK.Push,安装找到的Nuget包。

Requirements

.Net Framework 3.5

Running the Tests

测试使用NUnit 2.6.2,可以根据自己的喜好,使用支持NUnit的 Runner。

NUnit Test Adapter(Visual Studio 2012)

TestDriven.NET

JetBrain ReSharper

nunit-console

nunit runner 等

Contributing

Shi JIyong([email protected]) © Best Logistics Technology Co,.Ltd

Credits

Json.Net by James Newton-King

NUnit by NUnit Team

License

LicenseDetail

Donate

DonateDetail

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.