.net core 集成极光推送

登录极光推送 

创建应用

appkey和master secret在推送时会使用

设置推送

使用手机扫描二维码安装apk

下载dll

测试

using Jiguang.JPush;
using Jiguang.JPush.Model;
using System;
using System.Collections.Generic;

namespace JpushExample
{
    class Program
    {
        private static JPushClient client = new JPushClient("appKey", "masterSecret");
        static void Main(string[] args)
        {
            PushPayload pushPayload = new PushPayload()
            {
                Platform = new List<string> { "android", "ios" },
                Audience = "all",
                Notification = new Notification
                {
                    Alert = "hello jpush",
                    Android = new Android
                    {
                        Alert = "android alert",
                        Title = "title"
                    },
                    IOS = new IOS
                    {
                        Alert = "ios alert",
                        Badge = "+1"
                    }
                },
                Message = new Message
                {
                    Title = "message title",
                    Content = "message content",
                    Extras = new Dictionary<string, string>
                    {
                        ["key1"] = "value1"
                    }
                },
                Options = new Options
                {
                    IsApnsProduction = true // 设置 iOS 推送生产环境。不设置默认为开发环境。
                }
            };
            var response = client.SendPush(pushPayload);
            Console.WriteLine(response.Content);
            Console.WriteLine("Hello World!");
            Console.Read();
        }

  

猜你喜欢

转载自www.cnblogs.com/Justsoso-WYH/p/10550582.html