.gitignore
@@ -1,26 +1,189 @@ # Xcode # build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata *.xccheckout *.moved-aside DerivedData *.hmap *.ipa *.xcuserstate # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control # # Pods/ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. # User-specific files *.suo *.user *.sln.docstates # Build results [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ build/ bld/ [Bb]in/ [Oo]bj/ .vs/ packages/ .DS_Store # Roslyn cache directories *.ide/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* #NUNIT *.VisualState.xml TestResult.xml # Build Results of an ATL Project [Dd]ebugPS/ [Rr]eleasePS/ dlldata.c *_i.c *_p.c *_i.h *.ilk *.meta *.obj *.pch *.pdb *.pgc *.pgd *.rsp *.sbr *.tlb *.tli *.tlh *.tmp *.tmp_proj *.log *.vspscc *.vssscc .builds *.pidb *.svclog *.scc # Chutzpah Test files _Chutzpah* # Visual C++ cache files ipch/ *.aps *.ncb *.opensdf *.sdf *.cachefile # Visual Studio profiler *.psess *.vsp *.vspx # TFS 2012 Local Workspace $tf/ # Guidance Automation Toolkit *.gpState # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user # JustCode is a .NET coding addin-in .JustCode # TeamCity is a build add-in _TeamCity* # DotCover is a Code Coverage Tool *.dotCover # NCrunch _NCrunch_* .*crunch*.local.xml # MightyMoose *.mm.* AutoTest.Net/ # Web workbench (sass) .sass-cache/ # Installshield output folder [Ee]xpress/ # DocProject is a documentation generator add-in DocProject/buildhelp/ DocProject/Help/*.HxT DocProject/Help/*.HxC DocProject/Help/*.hhc DocProject/Help/*.hhk DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html # Click-Once directory publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml ## TODO: Comment the next line if you want to checkin your ## web deploy settings but do note that will include unencrypted ## passwords *.pubxml # NuGet Packages packages/* *.nupkg ## TODO: If the tool you use requires repositories.config ## uncomment the next line #!packages/repositories.config # Enable "build/" folder in the NuGet Packages folder since # NuGet packages use it for MSBuild targets. # This line needs to be after the ignore of the build folder # (and the packages folder if the line above has been uncommented) !packages/build/ # Windows Azure Build Output csx/ *.build.csdef # Windows Store app package directory AppPackages/ # Others sql/ *.Cache ClientBin/ [Ss]tyle[Cc]op.* ~$* *~ *.dbmdl *.dbproj.schemaview *.pfx *.publishsettings node_modules/ # RIA/Silverlight projects Generated_Code/ # Backup & report files from converting an old project file # to a newer Visual Studio version. Backup files are not needed, # because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm # SQL Server files *.mdf *.ldf # Business Intelligence projects *.rdl.data *.bim.layout *.bim_*.settings # Microsoft Fakes FakesAssemblies/ JPushGP.Droid/Additions/AboutAdditions.txt
New file @@ -0,0 +1,48 @@ Additions allow you to add arbitrary C# to the generated classes before they are compiled. This can be helpful for providing convenience methods or adding pure C# classes. == Adding Methods to Generated Classes == Let's say the library being bound has a Rectangle class with a constructor that takes an x and y position, and a width and length size. It will look like this: public partial class Rectangle { public Rectangle (int x, int y, int width, int height) { // JNI bindings } } Imagine we want to add a constructor to this class that takes a Point and Size structure instead of 4 ints. We can add a new file called Rectangle.cs with a partial class containing our new method: public partial class Rectangle { public Rectangle (Point location, Size size) : this (location.X, location.Y, size.Width, size.Height) { } } At compile time, the additions class will be added to the generated class and the final assembly will a Rectangle class with both constructors. == Adding C# Classes == Another thing that can be done is adding fully C# managed classes to the generated library. In the above example, let's assume that there isn't a Point class available in Java or our library. The one we create doesn't need to interact with Java, so we'll create it like a normal class in C#. By adding a Point.cs file with this class, it will end up in the binding library: public class Point { public int X { get; set; } public int Y { get; set; } } JPushGP.Droid/JPushGP.Droid.csproj
New file @@ -0,0 +1,73 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.30703</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{7247C19B-8277-4695-A05D-9F3CDF14877F}</ProjectGuid> <ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>JPushGP.Droid</RootNamespace> <AssemblyName>JPushGP.Droid</AssemblyName> <FileAlignment>512</FileAlignment> <Deterministic>True</Deterministic> <TargetFrameworkVersion>v9.0</TargetFrameworkVersion> <AndroidClassParser>class-parse</AndroidClassParser> <AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget> <RestoreProjectStyle>PackageReference</RestoreProjectStyle> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>portable</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>portable</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Mono.Android" /> <Reference Include="System" /> <Reference Include="System.Core" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <None Include="Jars\AboutJars.txt" /> <None Include="Additions\AboutAdditions.txt" /> </ItemGroup> <ItemGroup> <TransformFile Include="Transforms\Metadata.xml" /> <TransformFile Include="Transforms\EnumFields.xml" /> <TransformFile Include="Transforms\EnumMethods.xml" /> </ItemGroup> <ItemGroup> <EmbeddedJar Include="Jars\jcore-android-2.7.8-google_play.jar" /> <EmbeddedJar Include="Jars\jpush-android-4.0.6-google_play.jar" /> </ItemGroup> <ItemGroup> <EmbeddedNativeLibrary Include="Libs\armeabi-v7a\libjcore278.so" /> <EmbeddedNativeLibrary Include="Libs\arm64-v8a\libjcore278.so" /> <EmbeddedNativeLibrary Include="Libs\armeabi\libjcore278.so" /> </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> JPushGP.Droid/Jars/AboutJars.txt
New file @@ -0,0 +1,24 @@ This directory is for Android .jars. There are 2 types of jars that are supported: == Input Jar == This is the jar that bindings should be generated for. For example, if you were binding the Google Maps library, this would be Google's "maps.jar". Set the build action for these jars in the properties page to "InputJar". == Reference Jars == These are jars that are referenced by the input jar. C# bindings will not be created for these jars. These jars will be used to resolve types used by the input jar. NOTE: Do not add "android.jar" as a reference jar. It will be added automatically based on the Target Framework selected. Set the build action for these jars in the properties page to "ReferenceJar". JPushGP.Droid/Jars/jcore-android-2.7.8-google_play.jarBinary files differ
JPushGP.Droid/Jars/jpush-android-4.0.6-google_play.jarBinary files differ
JPushGP.Droid/Libs/arm64-v8a/libjcore278.soBinary files differ
JPushGP.Droid/Libs/armeabi-v7a/libjcore278.soBinary files differ
JPushGP.Droid/Libs/armeabi/libjcore278.soBinary files differ
JPushGP.Droid/Properties/AssemblyInfo.cs
New file @@ -0,0 +1,26 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle ("JPushGP.Droid")] [assembly: AssemblyDescription ("")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("JPushGP.Droid")] [assembly: AssemblyCopyright ("Copyright © 2021")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] [assembly: ComVisible (false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision [assembly: AssemblyVersion ("1.0.1.0")] [assembly: AssemblyFileVersion ("1.0.1.0")] JPushGP.Droid/Transforms/EnumFields.xml
New file @@ -0,0 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <enum-field-mappings> <!-- This example converts the constants Fragment_id, Fragment_name, and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag to an enum called Android.Support.V4.App.FragmentTagType with values Id, Name, and Tag. <mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType"> <field jni-name="Fragment_name" clr-name="Name" value="0" /> <field jni-name="Fragment_id" clr-name="Id" value="1" /> <field jni-name="Fragment_tag" clr-name="Tag" value="2" /> </mapping> --> </enum-field-mappings> JPushGP.Droid/Transforms/EnumMethods.xml
New file @@ -0,0 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <enum-method-mappings> <!-- This example changes the Java method: android.support.v4.app.Fragment.SavedState.writeToParcel (int flags) to be: android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags) when bound in C#. <mapping jni-class="android/support/v4/app/Fragment.SavedState"> <method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" /> </mapping> --> </enum-method-mappings> JPushGP.Droid/Transforms/Metadata.xml
New file @@ -0,0 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <metadata> <!-- This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask: <remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" /> This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground: <remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" /> --> </metadata> README.md
@@ -2,3 +2,9 @@ Google Playæå æ¨éåº //设置æå è°è¯æ¨¡å¼ï¼ä¸ºfalseæ¶åªæå°è¦åä¿¡æ¯ CN.Jpush.Android.Api.JPushInterface.SetDebugMode(false); CN.Jpush.Android.Api.JPushInterface.Init (this); //å ¶å®åèXamarin.Androidéæåèé颿件 Xamarin.Android¼¯³É²Î¿¼/AndroidManifest.xml
New file @@ -0,0 +1,131 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202104011" android:versionName="1.2.202104011" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" /> <!-- å¯è§å¯¹è®²æé--> <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- å®ä½æé--> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- æç §æé --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <!-- å¨å®åPçæ¬ä¹åï¼å¿ é¡»è¦æäºFOREGROUND_SERVICEæéï¼æè½å¤ä½¿ç¨åå°æå¡ --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- ææ¾æ¬å°é³ä¹æé--> <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!--æå æ¨é Required ä¸äºç³»ç»è¦æ±çæéï¼å¦è®¿é®ç½ç»ç--> <!-- Required ä¸äºç³»ç»è¦æ±çæéï¼å¦è®¿é®ç½ç»ç--> <permission android:name="com.hdl.onpro.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> <!-- Required --> <uses-permission android:name="com.hdl.onpro.permission.JPUSH_MESSAGE" /> <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.READ_LOGS" /> <!-- æå æ¨éç»æ --> <application android:allowBackup="true" android:icon="@drawable/Icon" android:networkSecurityConfig="@xml/network_security_config" android:largeHeap="true" android:label="ON+"> <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.hdl.onpro.fileProvider" android:grantUriPermissions="true" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider> <!--æå æ¨é--> <!-- Required SDK æ ¸å¿åè½--> <!-- å¯é ç½® android:process åæ°å° PushService æ¾å¨å ¶ä»è¿ç¨ä¸ --> <service android:name="cn.jpush.android.service.PushService" android:enabled="true" android:exported="false"> <intent-filter> <action android:name="cn.jpush.android.intent.REGISTER" /> <action android:name="cn.jpush.android.intent.REPORT" /> <action android:name="cn.jpush.android.intent.PushService" /> <action android:name="cn.jpush.android.intent.PUSH_TIME" /> </intent-filter> </service> <!-- since 3.0.9 Required SDK æ ¸å¿åè½--> <provider android:authorities="com.hdl.onpro.DataProvider" android:name="cn.jpush.android.service.DataProvider" android:exported="true" /> <!-- since 1.8.0 option å¯é项ãç¨äºåä¸è®¾å¤ä¸ä¸ååºç¨ç JPush æå¡ç¸äºæèµ·çåè½ã --> <!-- è¥ä¸å¯ç¨è¯¥åè½å¯å é¤è¯¥ç»ä»¶ï¼ææ enabled 设置æ false ï¼App ä¸ä¼è¢«å ¶ä» App æèµ·ï¼ä½ä¼æèµ·å ¶ä»ç Appã --> <service android:name="cn.jpush.android.service.DaemonService" android:enabled="false" android:exported="true"> <intent-filter> <action android:name="cn.jpush.android.intent.DaemonService" /> <category android:name="com.hdl.onpro" /> </intent-filter> </service> <!-- since 3.1.0 Required SDK æ ¸å¿åè½--> <provider android:authorities="com.hdl.onpro.DownloadProvider" android:name="cn.jpush.android.service.DownloadProvider" android:exported="true" /> <!-- Required SDK æ ¸å¿åè½--> <receiver android:name="cn.jpush.android.service.PushReceiver" android:enabled="true"> <intent-filter android:priority="1000"> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <category android:name="com.hdl.onpro" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.USER_PRESENT" /> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> <!-- Optional --> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED" /> <action android:name="android.intent.action.PACKAGE_REMOVED" /> <data android:scheme="package" /> </intent-filter> </receiver> <!-- Required SDK æ ¸å¿åè½--> <!-- è¥æ¨çä¸å¡ä¸æä½¿ç¨æå å¯åªä½åè½ï¼æè æå æ©ä¸å¥½åè½ï¼éè¦ææ¤ Activity ç exported 设置æ trueã --> <activity android:name="cn.jpush.android.ui.PushActivity" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar" android:exported="false"> <intent-filter> <action android:name="cn.jpush.android.ui.PushActivity" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="com.hdl.onpro" /> </intent-filter> </activity> <!-- SDK æ ¸å¿åè½--> <!-- è¥æ¨çä¸å¡ä¸æä½¿ç¨æå å¯åªä½åè½ï¼æè æå æ©ä¸å¥½åè½ï¼éè¦ææ¤ Activity ç exported 设置æ trueã --> <activity android:name="cn.jpush.android.ui.PopWinActivity" android:configChanges="orientation|keyboardHidden" android:exported="false" android:theme="@style/MyDialogStyle"> <intent-filter> <category android:name="android.intent.category.DEFAULT" /> <category android:name="com.hdl.onpro" /> </intent-filter> </activity> <!-- since 3.6.0 --> <activity android:name="cn.jpush.android.service.DActivity" android:enabled="true" android:exported="true" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:taskAffinity="jpush.custom"> <intent-filter> <action android:name="cn.jpush.android.intent.DActivity" /> <category android:name="com.hdl.onpro" /> </intent-filter> </activity> <!-- Required SDK æ ¸å¿åè½--> <receiver android:name="cn.jpush.android.service.AlarmReceiver" /> <!-- 3.5.0æ°å¢ï¼ç¨äºå®æ¶å±ç¤ºåè½ --> <receiver android:name="cn.jpush.android.service.SchedulerReceiver" android:exported="false" /> <!--Required SDKæ ¸å¿åè½ since 3.3.0--> <activity android:name="cn.jpush.android.service.JNotifyActivity" android:exported="true" android:taskAffinity="jpush.custom" android:theme="@android:style/Theme.Translucent.NoTitleBar"> <intent-filter> <action android:name="cn.jpush.android.intent.JNotifyActivity" /> <category android:name="com.hdl.onpro" /> </intent-filter> </activity> <!-- Required. For publish channel feature --> <!-- JPUSH_CHANNEL æ¯ä¸ºäºæ¹ä¾¿å¼åè ç»è®¡ APK å忏 éã--> <!-- ä¾å¦: --> <!-- åå° Google Play ç APK å¯ä»¥è®¾ç½®ä¸º google-play; --> <!-- åå°å ¶ä»å¸åºç APK å¯ä»¥è®¾ç½®ä¸º xxx-marketã --> <meta-data android:name="JPUSH_CHANNEL" android:value="developer-default" /> <!-- Required. AppKey copied from Portal --> <meta-data android:name="JPUSH_APPKEY" android:value="cbd90743ac45cbca06c8118b" /> <!-- æå æ¨éç»æ --> </application> </manifest> Xamarin.Android¼¯³É²Î¿¼/JPush/JPushReceiver.cs
New file @@ -0,0 +1,208 @@  using System; using Android.Content; using CN.Jpush.Android.Api; using CN.Jpush.Android.Service; using HDL_ON; using HDL_ON.DAL.Server; using Shared; 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 { private static string TAG = "JPushReceiver"; /// <summary> /// ç¨æ·ç¹å»æå¼äºéç¥ /// ç¹å»éç¥åè° /// </summary> /// <param name="context"></param> /// <param name="notificationMessage"></param> public override void OnNotifyMessageOpened(Context context, NotificationMessage notificationMessage) { //2020-12-23 è§£å³ç¹å»éç¥æ æå¼ä¸äºAPPé®é¢ //base.OnNotifyMessageOpened(context, notificationMessage); OpenNotification(context, notificationMessage); } /// <summary> /// æ¶å°éç¥åè° /// </summary> /// <param name="p0"></param> /// <param name="p1"></param> public override void OnNotifyMessageArrived(Context context, NotificationMessage notificationMessage) { base.OnNotifyMessageArrived(context, notificationMessage); var pushMes = new JPushMessageInfo() { Title = notificationMessage.NotificationTitle, Content = notificationMessage.NotificationContent, Extras = notificationMessage.NotificationExtras }; var jpushExpandData = GetJPushExpandData(pushMes); if (jpushExpandData != null && jpushExpandData.messageType != null) { pushMes.messageType = jpushExpandData.messageType; pushMes.expantContent = jpushExpandData.expantContent; 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(() => { HDLCommon.Current.AdjustPushMessage(pushMes); }); } /// <summary> /// /// </summary> /// <param name="pushMes"></param> /// <returns></returns> ExpandData GetJPushExpandData(JPushMessageInfo pushMes) { try { if (pushMes.Extras != null) { var jpushExpandData = Newtonsoft.Json.JsonConvert.DeserializeObject<JPushExpandData>(pushMes.Extras.ToString()); return Newtonsoft.Json.JsonConvert.DeserializeObject<ExpandData>(jpushExpandData.expandData); } return null; } catch { return null; } } /// <summary> /// 注åæååè° /// </summary> /// <param name="p0"></param> /// <param name="p1"></param> public override void OnRegister(Context context, string p1) { base.OnRegister(context, p1); Utlis.WriteLine("JPushOnRegister: " + p1); } ///// <summary> ///// å¤çæå ä¿¡æ¯æ¨é ///// </summary> ///// <param name="title">æ é¢</param> ///// <param name="message">ä¿¡æ¯</param> ///// <param name="extras">è´è½½æ°æ®</param> //public void AdjustJiguangMsgPush(JPushMessageInfo JPushMessageInfo) //{ // try // { // if (JPushMessageInfo.Extras.Contains("Offline") == true) // { // Shared.Application.RunOnMainThread(() => // { // //è´¦å·å¨å«å¤ç»éï¼è¢«è¸¢ä¸çº¿ 跳转å°ç»å½é¡µé¢ // new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show(); // //2020-12-04 å¾ å¢å éåºç»å½æä½ // }); // return; // } // else // { // Shared.Application.RunOnMainThread(() => // { // new Alert(JPushMessageInfo.Title, JPushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); // }); // return; // } // } // catch // { // } //} /// <summary> /// æå¼æ¶æ¯æ¾ç¤ºçé¢.010000 /// </summary> /// <param name="context"></param> /// <param name="notificationMessage"></param> private void OpenNotification(Context context, NotificationMessage notificationMessage) { try { var pushMes = new JPushMessageInfo() { Title = notificationMessage.NotificationTitle, Content = notificationMessage.NotificationContent, Extras = notificationMessage.NotificationExtras }; var jpushExpandData = GetJPushExpandData(pushMes); if (jpushExpandData != null && jpushExpandData.messageType != null) { pushMes.messageType = jpushExpandData.messageType; pushMes.expantContent = jpushExpandData.expantContent; 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); // } //}); } catch { } //catch (Exception ex) //{ // Utlis.WriteLine(ex.ToString()); //} } } } Xamarin.Android¼¯³É²Î¿¼/JPush/JPushService.cs
New file @@ -0,0 +1,11 @@  using CN.Jpush.Android.Service; namespace HDL_ON_Android { [Android.App.Service(Enabled =true,Exported =false,Process = ":pushcore")] [Android.App.IntentFilter(new string[] { "cn.jiguang.user.service.action" })] public class JPushService: JCommonService { } }