wxr
2022-06-30 23bbed132eea46eef51c6d01c21b346238e29ee2
HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -37,13 +37,8 @@
            //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>
        /// 收到通知回调
@@ -52,14 +47,7 @@
        /// <param name="p1"></param>
        public override void OnNotifyMessageArrived(Context context, NotificationMessage 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");
            base.OnNotifyMessageArrived(context, notificationMessage);
                var pushMes = new JPushMessageInfo()
                {
@@ -72,7 +60,7 @@
                if (jpushExpandData != null && jpushExpandData.messageType != null)
                {
                    pushMes.messageType = jpushExpandData.messageType;
                    pushMes.expantContent = jpushExpandData.expantContent;//spk
                pushMes.expantContent = jpushExpandData.expantContent;
                    pushMes.HomeId = jpushExpandData.homeId;
                    Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
                }
@@ -82,29 +70,11 @@
                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>
@@ -141,42 +111,6 @@
            Utlis.WriteLine("JPushOnRegister: " + p1);
        }
        ///// <summary>
        ///// 处理极光信息推送
        ///// </summary>
        ///// <param name="title">标题</param>
        ///// <param name="message">信息</param>
        ///// <param name="extras">负载数据</param>
        //public void AdjustJiguangMsgPush(JPushMessageInfo JPushMessageInfo)
        //{
        //    try
        //    {
        //        if (JPushMessageInfo.Extras.Contains("Offline") == true)
        //        {
        //            Shared.Application.RunOnMainThread(() =>
        //            {
        //                //账号在别处登陆,被踢下线 跳转到登录页面
        //                new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
        //                //2020-12-04 待增加退出登录操作
        //            });
        //            return;
        //        }
        //        else
        //        {
        //            Shared.Application.RunOnMainThread(() =>
        //            {
        //                new Alert(JPushMessageInfo.Title, JPushMessageInfo.Content, Language.StringByID(StringId.Close)).Show();
        //            });
        //            return;
        //        }
        //    }
        //    catch
        //    {
        //    }
        //}
        /// <summary>
        /// 打开消息显示界面.010000
        /// </summary>
@@ -184,7 +118,6 @@
        /// <param name="notificationMessage"></param>
        public static void OpenNotification(Context context, NotificationMessage notificationMessage)
        {
            try
            {
                var pushMes = new JPushMessageInfo()
@@ -208,47 +141,17 @@
                Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
                Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
                Intent i = new Intent(context, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
                i.SetFlags(ActivityFlags.NewTask);
                context.StartActivity(i);
                //解析msg
                AdjustPushMessage(pushMes);
                //Shared.Application.RunOnMainThread(() =>
                //{
                //    if (Shared.Application.Activity == null)
                //    {
                //        var tempIntent = new Intent(context, typeof(Shared.BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
                //        tempIntent.SetFlags(ActivityFlags.BroughtToFront);
                //        context.StartActivity(tempIntent);
                //        HDLCommon.Current.AdjustPushMessage(pushMes);
                //    }
                //    else
                //    {
                //        (Shared.Application.Activity as BaseActivity).MoveToFront();
                //        HDLCommon.Current.AdjustPushMessage(pushMes);
                //    }
                //});
                if (!MainPage.IsEnterBackground)
                {
                    NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
                    nMgr.CancelAll();
                }
            }
            catch
            {
            }
            //catch (Exception ex)
            //{
            //    Utlis.WriteLine(ex.ToString());
            //}
        }
        public static void AdjustPushMessage(JPushMessageInfo pushMes)
        {