wjc
2022-05-24 7cfcdb7a90f59bf9001c948e166fd9af09752fe1
HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -43,6 +43,8 @@
            OpenNotification(context, notificationMessage);
        }
       static int msgId = 0;
        /// <summary>
        /// 收到通知回调
        /// </summary>
@@ -50,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()
            {
@@ -80,16 +89,21 @@
            //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);
            });
            if (!MainPage.IsEnterBackground)
            {
                NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
                nMgr.CancelAll();
                }
            }
            catch (Exception wexx) {
                Console.WriteLine("safsdf"+wexx.Message);
            }
        }
@@ -218,6 +232,11 @@
                //        HDLCommon.Current.AdjustPushMessage(pushMes);
                //    }
                //});
                if (!MainPage.IsEnterBackground)
                {
                    NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
                    nMgr.CancelAll();
                }
            }
            catch
            {