HDL-ON_Android/HDL-ON_Android.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_Android/Other/JPush/JPushFirmBroadcast.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_Android/Other/JPush/JPushOpenClickActivity.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_Android/Other/JPush/JPushReceiver.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_Android/Properties/AndroidManifest.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_APP_Project.sln | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
HDL-ON_Android/HDL-ON_Android.csproj
@@ -28,7 +28,7 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>True</DebugSymbols> <DebugType>portable</DebugType> <Optimize>False</Optimize> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE;__Android__</DefineConstants> <ErrorReport>prompt</ErrorReport> @@ -43,6 +43,12 @@ <AndroidSigningKeyPass>85521566</AndroidSigningKeyPass> <AndroidSigningKeyAlias>on_plus</AndroidSigningKeyAlias> <PlatformTarget>AnyCPU</PlatformTarget> <AotAssemblies>false</AotAssemblies> <EnableLLVM>false</EnableLLVM> <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot> <BundleAssemblies>false</BundleAssemblies> <AndroidEnableMultiDex>false</AndroidEnableMultiDex> <AndroidUseAapt2>true</AndroidUseAapt2> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugSymbols>True</DebugSymbols> HDL-ON_Android/Other/JPush/JPushFirmBroadcast.cs
@@ -1,15 +1,11 @@ using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Views; using Android.Widget; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace JPushSample using System; using CN.Jpush.Android.Api; namespace HDL_ON_Android { [BroadcastReceiver(Enabled = true, Exported = false, Name = "com.hdl.onpro.JPushFirmBroadcast")] @@ -34,6 +30,31 @@ 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 { } } } HDL-ON_Android/Other/JPush/JPushOpenClickActivity.cs
@@ -1,19 +1,16 @@ using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Views; using Android.Widget; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Com.Hdl.ON.Jpush.Androidjpush; namespace JPushSample using Android.Views; namespace HDL_ON_Android { [Activity(LaunchMode = Android.Content.PM.LaunchMode.SingleTop, Exported = true, Enabled = true, Name = "com.hdl.onpro.JPushOpenClickActivity")] [Activity( Exported = true, Enabled = true, Name = "com.hdl.onpro.JPushOpenClickActivity" , Theme = "@android:style/Theme.Translucent.NoTitleBar", TaskAffinity = ":jpushopenclick")] [IntentFilter(new string[] { "com.hdl.onpro.JPushOpenClickActivity", Intent.ActionView }, Categories = new string[] { @@ -27,31 +24,31 @@ protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); View v = new View(this); SetContentView(v); HandleOpenClick(Intent); } protected void HandleOpenClick() protected void HandleOpenClick(Intent intent) { Intent intent = new Intent(); intent.SetAction("com.hdl.onpro.jpush.firm.NOTIFICATION_OPENED"); Intent broadcastIntent = new Intent(); broadcastIntent.SetAction("com.hdl.onpro.jpush.firm.NOTIFICATION_OPENED"); ComponentName componentName = new ComponentName(PackageName, "com.hdl.onpro.JPushFirmBroadcast"); if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { intent.SetComponent(componentName); broadcastIntent.SetComponent(componentName); } this.SendBroadcast(intent); FirmOpenClickHelper.Instance.HandleOpenClick(this, Intent, intent); FirmOpenClickHelper.Instance.HandleOpenClick(this, intent, broadcastIntent); Finish(); } protected override void OnNewIntent(Intent intent) { base.OnNewIntent(intent); Intent = intent; HandleOpenClick(); HandleOpenClick(intent); } } HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -7,22 +7,25 @@ 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 Handler UiHandler = new Handler(Looper.MainLooper); private static string TAG = "JPushReceiver"; /// <summary> /// 用户点击打开了通知 @@ -66,20 +69,21 @@ Utlis.WriteLine("PushMes title : " + pushMes.Title); Utlis.WriteLine("PushMes message : " + pushMes.Content); Utlis.WriteLine("PushMes extras : " + pushMes.Extras); Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId); 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 { @@ -149,8 +153,9 @@ /// </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() @@ -172,33 +177,32 @@ 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(() => { 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); //解析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 { @@ -209,6 +213,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(); } } } HDL-ON_Android/Properties/AndroidManifest.xml
@@ -87,6 +87,7 @@ <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider> <!--极光推送--> <provider android:name="Shared.Droid.JPush.HmsContentProvider" android:authorities="${applicationId}.hmspushprovider" android:exported="false"></provider> <!-- Required SDK 核心功能--> <!-- 可配置 android:process 参数将 PushService 放在其他进程中 --> <service android:name="cn.jpush.android.service.PushService" android:enabled="true" android:exported="false"> @@ -161,6 +162,8 @@ <category android:name="com.hdl.onpro" /> </intent-filter> </activity> <!-- Required. For publish channel feature --> <!-- JPUSH_CHANNEL 是为了方便开发者统计 APK 分发渠道。--> <!-- 例如: --> HDL_APP_Project.sln
@@ -27,8 +27,10 @@ GlobalSection(ProjectConfigurationPlatforms) = postSolution {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|Any CPU.Build.0 = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhone.ActiveCfg = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhone.Build.0 = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhone.Deploy.0 = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -38,7 +40,6 @@ {09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|iPhone.ActiveCfg = Debug|iPhone {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|iPhone.Build.0 = Debug|iPhone {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator @@ -50,7 +51,6 @@ {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.ActiveCfg = Debug|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.Build.0 = Debug|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU