当前位置:网站首页>Uni app native app local packaging integrated Aurora push (jg-jpush) detailed tutorial
Uni app native app local packaging integrated Aurora push (jg-jpush) detailed tutorial
2022-04-23 12:19:00 【Hua Weiyun】
One 、 Preface
Due to project requirements , need uni-app Native APP- Local packaging integration Aurora push , The integration process is sorted out and this paper .
Two 、 Integrate
2.1 uni-app Project integration to Android Studio
2.1.1 Copy HbuilderX uni-app Source code to AS
hbuilderX Use local packaging to generate android Resources are as follows :

Build empty android The project builds the following file structure ,apps Underlay hbuilderX Resource files generated by local packaging .

2.1.2 Download the latest SDK
stay Dcloud Download the latest SDK.
After downloading and decompressing, the directory is as follows

among ,
HBuilder-Hello: yesHelloH5packAppAn example of , It can be usedASPack it upAPK;HBuilder-Integrate-AS: yesHBuilder 5+ SDKIntegrateASAn example of ;SDK: yesHBuilder SDKThe library filesUniPlugin-Hello-AS: Is to develop plug-ins and integrate them intoVueAn example of .
2.1.3 Copy HBuilder-Hello project data To the corresponding directory of your project

2.1.4 Copy HBuilder-Hello project libs Put the three files in the corresponding directory of your project

2.1.5 modify dcloud_control.xml The configuration file
Be careful ️:appid by HbuilderX uni-app Project identification .
<hbuilder><apps> <app appid="__UNI__1DA6F85" appver=""/></apps></hbuilder>
2.1.6 androidmanifest.xml Add activity node
Add the following
<activity android:name="io.dcloud.PandoraEntry" android:configChanges="orientation|keyboardHidden|keyboard|navigation" android:label="@string/app_name" android:launchMode="singleTask" android:hardwareAccelerated="true" android:theme="@style/TranslucentTheme" android:screenOrientation="user" android:windowSoftInputMode="adjustResize" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter></activity><activity android:name="io.dcloud.PandoraEntryActivity" android:launchMode="singleTask" android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale|keyboard" android:hardwareAccelerated="true" android:permission="com.miui.securitycenter.permission.AppPermissionsEditor" android:screenOrientation="user" android:theme="@style/DCloudTheme" android:windowSoftInputMode="adjustResize"> <intent-filter> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <action android:name="android.intent.action.VIEW" /> <data android:scheme="h56131bcf" /> </intent-filter></activity>
After the above configuration , Can be realized hbuilderx Local offline packaging android project , Generate APK Installation package .
First download jpush-hbuilder-demo Demo application .
Copy ./android/app/src/main/java/io.dcloud.feature.jpush Folder to you Android Studio engineering /src/main/java/ Under the table of contents .
Copy ./jpush.js To you Android Studio engineering /assets/apps/HBuilder Application name /js/ Next .
stay /assets/apps/ Your app name /www/manifest.json Add... To the file :
"Push": { "description": " Message push "}
stay /assets/data/dcloud_properties.xml Add ( If it already exists Push feature, Can be modified directly ):
<feature name="Push" value="io.dcloud.feature.jpush.JPushService" ></feature>
stay app/build.gradle Add :
android { ... defaultConfig { applicationId "com.xxx.xxx" // JPush Package name registered on . ... ndk { // Select the corresponding to add cpu Type of .so library . abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a' // You can also add 'x86', 'x86_64', 'mips', 'mips64' } manifestPlaceholders = [ JPUSH_PKGNAME : applicationId, JPUSH_APPKEY : " Applied AppKey", // JPush The package name registered on corresponds to appkey JPUSH_CHANNEL : "developer-default", // Fill in the default value temporarily ] ... } ...}dependencies { ... compile 'cn.jiguang.sdk:jpush:3.3.4' // Here to JPush 3.3.4 Version as an example . compile 'cn.jiguang.sdk:jcore:2.1.2' // Here to JCore 2.1.2 Version as an example . ...}
stay AndroidManifest.xml Add :
<!-- since 3.3.0 Required SDK Core functions --> <!-- Configurable android:process Parameter will PushService In other processes --> <!--User defined. For test only Inherited from cn.jpush.android.service.JCommonService--> <service android:name="io.dcloud.feature.jpush.PushService" android:process=":pushcore"> <intent-filter> <action android:name="cn.jiguang.user.service.action" /> </intent-filter> </service> <!-- User defined. For test only User defined receive message ,3.0.7 Start supporting , New at present tag/alias The result of interface setting will be called back in the corresponding method of the broadcast receiver --> <!--since 3.3.0 receive JPush Related events --> <receiver android:name="io.dcloud.feature.jpush.PushMessageReceiver"> <intent-filter> <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" /> <category android:name="${applicationId}"></category> </intent-filter> </receiver><receiver android:name="io.dcloud.feature.jpush.JPushReceiver" android:enabled="true" android:exported="false"> <intent-filter> <action android:name="cn.jpush.android.intent.REGISTRATION" /> <!-- Required User registration SDK Of intent --> <action android:name="cn.jpush.android.intent.UNREGISTRATION" /> <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!-- Required The user receives SDK News intent --> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!-- Required The user receives SDK Notice column information intent --> <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!-- Required The user opens the custom notification bar intent --> <action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK" /> <!-- Optional Users accept Rich Push Javascript Of the callback function intent --> <action android:name="cn.jpush.android.intent.CONNECTION" /> <!-- Receive network changes Connect / To break off since 1.6.3 --> <category android:name="${JPUSH_PKGNAME}" /> </intent-filter></receiver>
3、 ... and 、 Problems encountered and solutions
3.1 libs in sdk Version and app sdk Version inconsistency
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [weex_videoplayer-release.aar] /Users/huaqiangsun/.gradle/caches/transforms-2/files-2.1/22285093409dba775963f444b0533dd8/weex_videoplayer-release/AndroidManifest.xml as the library might be using APIs not available in 16.Suggestion: use a compatible library with a minSdk of at most 16,or increase this project's minSdk version to at least 19,or use tools:overrideLibrary="io.dcloud.feature.weex_media" to force usage (may lead to runtime failures)
Solutions : Need to be in build.gradle(Moudle app) in minSdkVersion Change it to 19.
3.2 Suggestion: add ‘tools:replace=“android:resource”’ to <meta-data> element at AndroidManifest.xml to override
Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/filepaths) from [lib.5plus.base-release.aar] AndroidManifest.xml:243:17-61is also present at [torch-plgdtsdk-5.17.3157.aar] AndroidManifest.xml:48:17-57 value=(@xml/torch_file_paths).Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.
Solutions : stay AndroidManifest.xml Add... Under the root tag of xmlns:tools="http://schemas.android.com/tools", And then in application Add... Under the label tools:replace="android:name".
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.**"> <application android:name="com.**.App" android:allowBackup="true" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" tools:replace="android:name"> </application></manifest>
Four 、 Expanding reading
- 《 Advanced cross platform application development ( 8、 ... and ) :uni-app Native APP- Cloud packaging integrates Aurora push (JG-JPUSH) Detailed tutorial 》
版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231218022921.html
边栏推荐
- Qt重绘事件与剪切
- SynchronousQueue 源码解析
- Chapter 5 optimizing queries using in memory expressions (IM 5.1)
- 第二十四课 经典问题解析
- The fourth chapter is the enable and disable columns of IM enabled fill objects (Part III of im-4.3)
- Relu function of activation function
- 异步时钟亚稳态 的解决方案——多bit信号
- 一个平面设计师的异想世界|ONES 人物
- worder字体网页字体对照表
- Symmetric encryption, certificate encryption
猜你喜欢

Qt双缓冲绘图

AI video cloud vs narrowband HD, who is the darling of the video era

【unity笔记】L4Unity中的基础光照

Sigmoid function of activation function
Xinwangda announced that the price of battery products had been increased, and the investment of "weixiaoli" exceeded 1 billion

Relu function of activation function

31岁才转行程序员,目前34了,我来说说我的经历和一些感受吧...

Database Navigator 使用默认MySQL连接提示:The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or repres

Worder font page font comparison table

天梯赛赛前练习
随机推荐
Symmetric encryption, certificate encryption
QT redraw events and cuts
Lesson 23 temporary objects
MySQL函数-递归函数
How much does software testing help reduce program bugs?
Database Navigator 使用默认MySQL连接提示:The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or repres
IDEA 中 .properties文件的中文显示乱码问题的解决办法
Idea code quality specification plug-in sonarlint
Force buckle - 70 climb stairs
Lesson 24 analysis of classical problems
Step function of activation function
Chapter 4 specifies the attribute of the inmemory column on the no inmemory table for im enabled filling objects: examples (Part IV of im-4.4)
IDEA 数据库插件Database Navigator 插件
c# 设置logo图标和快捷方式的图标
Solution of asynchronous clock metastability -- multi bit signal
On lambda powertools typescript
IDEA设置版权信息
Qt一个进程运行另一个进程
Lesson 25 static member variables of classes
《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?