1:首先你需要
DCloud开发者中心 https://dev.dcloud.net.cn/
该注册的注册,该开通的要开通,然后你要拿到4个KEY
------------------------------------------------------------------
开发者中心 - 我创建的应用 - app ---[新页面]Uni Push -消息推送 - 隆平高科益阳信息化应用 -- 配置管理 - 应用配置:
AppID: kylXOxxxxxxd8Al3yT39ELR1
AppKey: 6IMOxxxxx19mbes3BHW8A3
AppSecret: Rdwxxxxxl7lRlIizavve6
MasterSecret: 3bPxxxxxxCuORvJ39Jl4
------------------------------------------------------------------
2:开始写推送代码,参考文档:鉴权API-个推文档中心 https://docs.getui.com/getui/server/rest_v2/token/
2.1 调用第一个接口获取token
然后调用推送接口开始推送,都在下面了
using learun.util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography;
using System.Text;
namespace learun.appdev.Common
{
/// <summary>
/// APP个推帮助类
/// </summary>
public static class AppSendHelper
{
/// <summary>
///
/// </summary>
private static string appSendToken = "";
private static string AppID = "kylXXXXXXd8Al3yT39ELR1";
private static string AppKey = "6IMONXXXXXbes3BHW8A3";
private static string AppSecret = "RdXXXXXRlIizavve6";
private static string MasterSecret = "3XXXXXXXuORvJ39Jl4";
/// <summary>
/// 获取token
/// </summary>
/// <returns></returns>
public static string GetAppSendToken()
{
string token = "";
if (!string.IsNullOrWhiteSpace(appSendToken))
{
return appSendToken;
}
//签名 : appkey+timestamp+mastersecret SHA256加密
string timestamp =