From a01f2b7bb230a6a384ba1555280e3977154488a1 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 23 十二月 2020 20:42:44 +0800
Subject: [PATCH] 2020-12-23 1.解决点击通知栏打开不了APP问题

---
 HDL-ON_Android/Other/JPush/JPushReceiver.cs |   41 +++++++++++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/HDL-ON_Android/Other/JPush/JPushReceiver.cs b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
index 86c19ae..ff8a03b 100644
--- a/HDL-ON_Android/Other/JPush/JPushReceiver.cs
+++ b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -1,4 +1,5 @@
 锘�
+using System;
 using Android.Content;
 using CN.Jpush.Android.Api;
 using CN.Jpush.Android.Service;
@@ -30,7 +31,8 @@
         /// <param name="notificationMessage"></param>
         public override void OnNotifyMessageOpened(Context context, NotificationMessage notificationMessage)
         {
-            base.OnNotifyMessageOpened(context, notificationMessage);
+            //2020-12-23 瑙e喅鐐瑰嚮閫氱煡鏍忔墦寮�涓嶄簡APP闂
+            //base.OnNotifyMessageOpened(context, notificationMessage);
 
             OpenNotification(context, notificationMessage);
         }
@@ -164,26 +166,41 @@
                 Utlis.WriteLine("PushMes title : " + pushMes.Title);
                 Utlis.WriteLine("PushMes message : " + pushMes.Content);
                 Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
-
-                if (Shared.Application.Activity == null)
+                Shared.Application.RunOnMainThread(() =>
                 {
-                    var tempIntent = new Intent(context, typeof(Shared.BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
-                    tempIntent.SetFlags(ActivityFlags.BroughtToFront);
-                    context.StartActivity(tempIntent);
+                    Intent i = new Intent(context, typeof(BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
+                    i.SetFlags(ActivityFlags.NewTask);
+                    context.StartActivity(i);
 
                     HDLCommon.Current.AdjustPushMessage(pushMes);
-                }
-                else
-                {
-                    (Shared.Application.Activity as BaseActivity).MoveToFront();
+                });
 
-                    HDLCommon.Current.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);
+                //    }
+                //});
             }
             catch
             {
 
             }
+            //catch (Exception ex)
+            //{
+            //    Utlis.WriteLine(ex.ToString());
+            //}
         }
     }
     

--
Gitblit v1.8.0