From 1460cb4a3c4e1ec3e9272b8bf0583d13012578f9 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 28 十月 2021 17:10:55 +0800
Subject: [PATCH] 还原音乐功能
---
HDL-ON_Android/Other/JPush/JPushReceiver.cs | 109 ++++++++++++++++++++++++++++++++++--------------------
1 files changed, 68 insertions(+), 41 deletions(-)
diff --git a/HDL-ON_Android/Other/JPush/JPushReceiver.cs b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
index b15ec4d..9438176 100644
--- a/HDL-ON_Android/Other/JPush/JPushReceiver.cs
+++ b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -1,27 +1,30 @@
锘�
using System;
+using Android.App;
using Android.Content;
using CN.Jpush.Android.Api;
using CN.Jpush.Android.Service;
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[]
+ Categories = new string[]
{
"com.hdl.onpro"
})]
public class JPushReceiver : JPushMessageReceiver
- {
-
+ {
+
+
private static string TAG = "JPushReceiver";
/// <summary>
/// 鐢ㄦ埛鐐瑰嚮鎵撳紑浜嗛�氱煡
@@ -57,24 +60,29 @@
if (jpushExpandData != null && jpushExpandData.messageType != null)
{
pushMes.messageType = jpushExpandData.messageType;
+ pushMes.expantContent = jpushExpandData.expantContent;
+ pushMes.HomeId = jpushExpandData.homeId;
Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
}
Utlis.WriteLine("PushMes title : " + pushMes.Title);
Utlis.WriteLine("PushMes message : " + pushMes.Content);
Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
+ Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
+
Shared.Application.RunOnMainThread(() =>
{
HDLCommon.Current.AdjustPushMessage(pushMes);
});
- }
+ }
+
/// <summary>
///
/// </summary>
/// <param name="pushMes"></param>
/// <returns></returns>
- ExpandData GetJPushExpandData(JPushMessageInfo pushMes)
+ static ExpandData GetJPushExpandData(JPushMessageInfo pushMes)
{
try
{
@@ -100,7 +108,6 @@
public override void OnRegister(Context context, string p1)
{
base.OnRegister(context, p1);
-
Utlis.WriteLine("JPushOnRegister: " + p1);
}
@@ -114,8 +121,6 @@
//{
// try
// {
-
-
// if (JPushMessageInfo.Extras.Contains("Offline") == true)
// {
// Shared.Application.RunOnMainThread(() =>
@@ -143,12 +148,13 @@
//}
/// <summary>
- /// 鎵撳紑娑堟伅鏄剧ず鐣岄潰
+ /// 鎵撳紑娑堟伅鏄剧ず鐣岄潰.010000
/// </summary>
/// <param name="context"></param>
/// <param name="notificationMessage"></param>
- private void OpenNotification(Context context, NotificationMessage notificationMessage)
- {
+ public static void OpenNotification(Context context, NotificationMessage notificationMessage)
+ {
+
try
{
var pushMes = new JPushMessageInfo()
@@ -162,38 +168,40 @@
if (jpushExpandData != null && jpushExpandData.messageType != null)
{
pushMes.messageType = jpushExpandData.messageType;
+ pushMes.expantContent = jpushExpandData.expantContent; ;
+ pushMes.HomeId = jpushExpandData.homeId;
Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
}
Utlis.WriteLine("PushMes title : " + pushMes.Title);
Utlis.WriteLine("PushMes message : " + pushMes.Content);
Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
- Shared.Application.RunOnMainThread(() =>
- {
- Intent i = new Intent(context, typeof(BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
- i.SetFlags(ActivityFlags.NewTask);
- context.StartActivity(i);
-
- 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);
- // }
- //});
+ 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);
+ //瑙f瀽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);
+ // }
+ //});
}
catch
{
@@ -204,6 +212,25 @@
// Utlis.WriteLine(ex.ToString());
//}
}
- }
-
+
+
+
+ public static void AdjustPushMessage(JPushMessageInfo pushMes)
+ {
+
+ new System.Threading.Thread(new System.Threading.ThreadStart(() =>
+ {
+ while (MainPage.BasePageView == null)
+ {
+ System.Threading.Thread.Sleep(300);
+ }
+ Shared.Application.RunOnMainThread(() =>
+ {
+ HDLCommon.Current.AdjustPushMessage(pushMes);
+ });
+ })).Start();
+
+ }
+ }
+
}
\ No newline at end of file
--
Gitblit v1.8.0