wxr
2024-09-11 a3dfbcd5218270f9a75e6e32807b08215270b657
HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -1,31 +1,50 @@

using System;
using Android.App;
using Android.Content;
using CN.Jpush.Android.Api;
using CN.Jpush.Android.Service;
using Com.Hdl.Hdllinphonesdk;
using HDL_ON;
using HDL_ON.DAL.Server;
using Shared;
using Android.OS;
namespace HDL_ON_Android
{
    [BroadcastReceiver(Enabled = true, Exported = false)]
    [Android.App.IntentFilter(new string[]
    {
        "cn.jpush.android.intent.RECEIVE_MESSAGE"
    },
    Categories = new string[]
    {
        "com.hdl.onpro"
    })]
    public class JPushReceiver : JPushMessageReceiver
    //[BroadcastReceiver(Enabled = true, Exported = false)]
    //[Android.App.IntentFilter(new string[]
    //{
    //    "cn.jpush.android.intent.RECEIVE_MESSAGE"
    //},
    //Categories = new string[]
    //{
    //    "com.hdl.onpro"
    //})]
    //[Android.App.Service(Enabled = true)]
    //[Android.App.IntentFilter(
    //    new string[] { "cn.jpush.android.intent.SERVICE_MESSAGE" },
    //    Categories = new string[]
    //    {
    //        "com.hdl.onpro"
    //    })]
    [BroadcastReceiver(Enabled = true, Exported = true)]
    [Android.App.IntentFilter(new string[] { "cn.jpush.android.intent.SERVICE_MESSAGE" }, Categories = new string[] { "com.hdl.onpro" })]
    public class JPushReceiver : JPushMessageReceiver// JPushMessageService
    {
        private static string TAG = "JPushReceiver";
        public override void OnMessage(Context p0, CustomMessage p1)
        {
            Console.WriteLine("收到极光推送");
            base.OnMessage(p0, p1);
        }
        /// <summary>
        /// 用户点击打开了通知
        /// 点击通知回调
@@ -63,14 +82,10 @@
                pushMes.messageType = jpushExpandData.messageType;
                pushMes.expantContent = jpushExpandData.expantContent;
                pushMes.HomeId = jpushExpandData.homeId;
                Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
                Utlis.WriteLine("收到通知回调\r\nPushMes messageType : " + pushMes.messageType);
            }
            if (!string.IsNullOrEmpty(pushMes.spk))//自研可视对讲需要记录时间反呼
            {
                UserInfo.Current.pushMessageInfo = pushMes;
                UserInfo.Current.inCall = DateTime.Now;
            }
            Utlis.WriteLine("PushMes title : " + pushMes.Title);
            Utlis.WriteLine("PushMes message : " + pushMes.Content);
@@ -115,7 +130,6 @@
        public override void OnRegister(Context context, string p1)
        {
            base.OnRegister(context, p1);
            Utlis.WriteLine("JPushOnRegister: " + p1);
        }
        /// <summary>
@@ -150,13 +164,13 @@
                if (Shared.Application.Activity==null)
                {
                    Intent i = new Intent(context, typeof(SplashActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
                    Intent i = new Intent(context, typeof(SplashActivity));
                    i.SetFlags(ActivityFlags.NewTask);
                    context.StartActivity(i);
                }
                else
                {
                    Intent i = new Intent(context, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
                    Intent i = new Intent(context, typeof(BaseActivity));
                    i.SetFlags(ActivityFlags.NewTask);
                    context.StartActivity(i);
                }