当前位置:网站首页>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
: yesHelloH5
packApp
An example of , It can be usedAS
Pack it upAPK
;HBuilder-Integrate-AS
: yesHBuilder 5+ SDK
IntegrateAS
An example of ;SDK
: yesHBuilder SDK
The library filesUniPlugin-Hello-AS
: Is to develop plug-ins and integrate them intoVue
An 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重绘事件与剪切
- 初探 Lambda Powertools TypeScript
- Markdown语法学习
- NativeForMySQL 连接MySQL8 提示:1251- Client does not support authentication protocol
- The database navigator uses the default MySQL connection prompt: the server time zone value 'Ö Ð¹ ú±ê ×¼ ʱ ¼ ä’ is unrecognized or repres
- Solution of asynchronous clock metastability -- multi bit signal
- The maximum number of remote desktop servers has been exceeded
- Array---
- 第四章 为IM 启用填充对象之启用和禁用表空间的IM列存储(IM 4.5)
- One way ANOVA of SPSS
猜你喜欢
欣旺达宣布电池产品涨价 此前获“蔚小理”投资超10亿
Windows11 安装MySQL服务 提示:Install/Remove of the Service Denied
Idea database navigator plug-in
为什么要有包装类,顺便说一说基本数据类型、包装类、String类该如何转换?
Fastjson 2 来了,性能继续提升,还能再战十年
QT one process runs another
The maximum number of remote desktop servers has been exceeded
One way ANOVA of SPSS
5-minute NLP: text to text transfer transformer (T5) unified text to text task model
I changed to a programmer at the age of 31. Now I'm 34. Let me talk about my experience and some feelings
随机推荐
SQLserver怎么插入或更新当天的星期数,bit而不是文本
天梯赛赛前练习
万事有你 未来可期 | ONES 2022校园招聘正式开启
网络信息安全之零信任
How the database fills in IM expressions (IM 5.4)
Qt绘制图像
画结果图推荐网址
Solution of asynchronous clock metastability -- multi bit signal
QT one process runs another
How to expand the capacity of the server in the 100 million level traffic architecture? Well written!
关于使用Go语言创建WebSocket服务浅谈
Qt进程间通信
第四章 为IM 启用填充对象之为IM列存储启用ADO(IM 4.8)
宝塔面板命令行帮助教程(包含重置密码)
PSCP basic usage
Idea code formatting plug-in save actions
Windows11 安装MySQL服务 提示:Install/Remove of the Service Denied
软件测试对于减少程序BUG有多大帮助?
QT redraw events and cuts
在 VSCode 中调试 Jest 的测试用例,VSCode调试Jest测试用例报错basedir=$(dirname “$(echo “$0“ | sed -e ‘s,\\,/,g‘)“)解决