wxr
2022-05-17 4c586bb23cdcae56ae4e4c62e90e148dc10b9d90
HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -37,8 +37,13 @@
            //2020-12-23 解决点击通知栏打开不了APP问题
            //base.OnNotifyMessageOpened(context, notificationMessage);
            //NotificationManager NotifyManager = (NotificationManager)GetSystemService(Context.NotificationService);
            //NotificationManager notificationManager = NotifyManager;
            OpenNotification(context, notificationMessage);
        }
       static int msgId = 0;
        /// <summary>
        /// 收到通知回调
@@ -47,7 +52,14 @@
        /// <param name="p1"></param>
        public override void OnNotifyMessageArrived(Context context, NotificationMessage notificationMessage)
        {
            base.OnNotifyMessageArrived(context, notificationMessage);
            try
            {
                NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
                if (msgId != 0)
                    nMgr.Cancel(msgId);
                msgId = notificationMessage.NotificationId;
                base.OnNotifyMessageArrived(context, notificationMessage); Console.WriteLine("123456789ghjsdjfasdfk");
            var pushMes = new JPushMessageInfo()
            {
@@ -60,7 +72,7 @@
            if (jpushExpandData != null && jpushExpandData.messageType != null)
            {
                pushMes.messageType = jpushExpandData.messageType;
                pushMes.expantContent = jpushExpandData.expantContent;
                    pushMes.expantContent = jpushExpandData.expantContent;//spk
                pushMes.HomeId = jpushExpandData.homeId;
                Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
            }
@@ -70,11 +82,29 @@
            Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
            Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
                //UserInfo.Current.PushMesTitle = pushMes.Title;
                //UserInfo.Current.PushMesMessage = pushMes.Content;
                //UserInfo.Current.PushMesExtras = pushMes.Extras;
                //UserInfo.Current.pushMesMessageType = pushMes.messageType;
                //UserInfo.Current.pushMesExpantContent = pushMes.expantContent;
                //UserInfo.Current.PushMesHomeId = pushMes.HomeId;
                UserInfo.Current.pushMessageInfo = pushMes;
                if (!string.IsNullOrEmpty(pushMes.spk))//自研可视对讲需要记录时间反呼
                    UserInfo.Current.inCall = DateTime.Now;
                if (!MainPage.IsEnterBackground)
                {
                    //NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
                    //nMgr.CancelAll();
            Shared.Application.RunOnMainThread(() =>
            {
                HDLCommon.Current.AdjustPushMessage(pushMes);
            });
                }
            }
            catch (Exception wexx) {
                Console.WriteLine("safsdf"+wexx.Message);
            }
        }
        /// <summary>
@@ -202,6 +232,11 @@
                //        HDLCommon.Current.AdjustPushMessage(pushMes);
                //    }
                //});
                if (!MainPage.IsEnterBackground)
                {
                    NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
                    nMgr.CancelAll();
                }
            }
            catch
            {