From ea0b1e8e5f43c5fd0a7d479e25ede3b8cbea464a Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期一, 02 十二月 2024 17:17:19 +0800 Subject: [PATCH] tcp;可视对讲; --- HDL-ON_Android/Other/JPush/JPushReceiver.cs | 65 ++++++++++++++++++++++---------- 1 files changed, 44 insertions(+), 21 deletions(-) diff --git a/HDL-ON_Android/Other/JPush/JPushReceiver.cs b/HDL-ON_Android/Other/JPush/JPushReceiver.cs index 07f2fcb..ac68a0f 100644 --- a/HDL-ON_Android/Other/JPush/JPushReceiver.cs +++ b/HDL-ON_Android/Other/JPush/JPushReceiver.cs @@ -7,25 +7,41 @@ 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.santan.smartcontrol" + //})] + + + [Android.App.Service(Enabled = true, Exported = false)] + [Android.App.IntentFilter( + new string[] { "cn.jpush.android.intent.SERVICE_MESSAGE" }, + Categories = new string[] + { + "com.santan.smartcontrol" + })] + public class JPushReceiver : JPushMessageService { private static string TAG = "JPushReceiver"; + + public override void OnMessage(Context p0, CustomMessage p1) + { + Console.WriteLine("鏀跺埌鏋佸厜鎺ㄩ��"); + base.OnMessage(p0, p1); + + } + /// <summary> /// 鐢ㄦ埛鐐瑰嚮鎵撳紑浜嗛�氱煡 /// 鐐瑰嚮閫氱煡鍥炶皟 @@ -35,9 +51,7 @@ public override void OnNotifyMessageOpened(Context context, NotificationMessage notificationMessage) { //2020-12-23 瑙e喅鐐瑰嚮閫氱煡鏍忔墦寮�涓嶄簡APP闂 - //base.OnNotifyMessageOpened(context, notificationMessage); - - OpenNotification(context, notificationMessage); + OpenNotification(context, notificationMessage,true); } /// <summary> @@ -114,7 +128,7 @@ public override void OnRegister(Context context, string p1) { base.OnRegister(context, p1); - Utlis.WriteLine("JPushOnRegister: " + p1); + Utlis.WriteLine("鏋佸厜鎺ㄩ��-娉ㄥ唽鎴愬姛鍥炶皟: " + p1); } /// <summary> @@ -122,7 +136,7 @@ /// </summary> /// <param name="context"></param> /// <param name="notificationMessage"></param> - public static void OpenNotification(Context context, NotificationMessage notificationMessage) + public static void OpenNotification(Context context, NotificationMessage notificationMessage, bool isNotification = false) { try { @@ -130,7 +144,8 @@ { Title = notificationMessage.NotificationTitle, Content = notificationMessage.NotificationContent, - Extras = notificationMessage.NotificationExtras + Extras = notificationMessage.NotificationExtras, + isNotificationGoing = isNotification }; var jpushExpandData = GetJPushExpandData(pushMes); @@ -147,9 +162,18 @@ 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); + if (Shared.Application.Activity == null) + { + Intent i = new Intent(context, typeof(SplashActivity)); + i.SetFlags(ActivityFlags.NewTask); + context.StartActivity(i); + } + else + { + Intent i = new Intent(context, typeof(BaseActivity)); + i.SetFlags(ActivityFlags.NewTask); + context.StartActivity(i); + } //瑙f瀽msg AdjustPushMessage(pushMes); } @@ -161,7 +185,6 @@ public static void AdjustPushMessage(JPushMessageInfo pushMes) { - new System.Threading.Thread(new System.Threading.ThreadStart(() => { while (MainPage.BasePageView == null) -- Gitblit v1.8.0