From 95a7e380db583108d9716c56fe6d298ca08f8f23 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 07 九月 2021 10:13:53 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/jpush_tst' into wxr7 --- HDL-ON_Android/Other/JPush/JPushFirmBroadcast.cs | 61 ++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/HDL-ON_Android/Other/JPush/JPushFirmBroadcast.cs b/HDL-ON_Android/Other/JPush/JPushFirmBroadcast.cs new file mode 100644 index 0000000..d563368 --- /dev/null +++ b/HDL-ON_Android/Other/JPush/JPushFirmBroadcast.cs @@ -0,0 +1,61 @@ +锘� +using Android.Content; + +using System; + +using CN.Jpush.Android.Api; + +namespace HDL_ON_Android +{ + + [BroadcastReceiver(Enabled = true, Exported = false, Name = "com.hdl.onpro.JPushFirmBroadcast")] + [Android.App.IntentFilter(new string[] + { + "com.hdl.onpro.jpush.firm.NOTIFICATION_OPENED" + }, + Categories = new string[] + { + Intent.CategoryDefault + })] + class JPushFirmBroadcast : BroadcastReceiver + { + + + public override void OnReceive(Context context, Intent intent) + { + + /* 鐢ㄦ潵鎺ユ敹鍘傚晢鐐瑰嚮閫氱煡娑堟伅锛岄渶瑕佹墦寮�MainActivity 闇�瑕佽嚜琛岃皟鐢� + cn.jpush.android.EXTRA,cn.jpush.android.MSG_ID, + cn.jpush.android.TYPE_PLATFORM, + cn.jpush.android.TITLE, + cn.jpush.android.MESSAGE*/ + + try + { + NotificationMessage notificationMessage = new NotificationMessage(); + String extra = intent.GetStringExtra(JPushInterface.ExtraExtra); + String msgId = intent.GetStringExtra(JPushInterface.ExtraMsgId); + + String message = intent.GetStringExtra(JPushInterface.ExtraMessage); + String title = intent.GetStringExtra(JPushInterface.ExtraTitle); + // String typePlatform = intent.GetStringExtra(JPushInterface.ExtraTypePlatform); + + notificationMessage.NotificationTitle = title; + notificationMessage.NotificationContent = message; + notificationMessage.NotificationExtras = extra; + + JPushReceiver.OpenNotification(context, notificationMessage); + + } + catch + { + + } + + + + + + } + } +} \ No newline at end of file -- Gitblit v1.8.0