当前位置:网站首页>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
边栏推荐
- Interpretation 3 of gdpr series: how do European subsidiaries return data to domestic parent companies?
- Lesson 23 temporary objects
- Tan Xiang, CEO of Kechuang · Pera software: the essence of zero trust is digital security. To B should also deeply study the user's mind
- Metalama简介4.使用Fabric操作项目或命名空间
- 第四章 为IM 启用填充对象之在NO INMEMORY表上指定INMEMORY列属性:示例(IM-4.4 第四部分)
- Introduction to metalama 4 Use fabric to manipulate items or namespaces
- Windows2008系统如何切换PHP版本
- How much does software testing help reduce program bugs?
- Next. JS static data generation and server-side rendering
- Chapter 4: enable and disable im column storage for materialized view (IM 4.6)
猜你喜欢
Nativeformysql connects to MySQL 8 prompt: 1251 - client does not support authentication protocol
1. Construction of electron development environment
C set Logo Icon and shortcut icon
同态加密技术学习
Introduction to metalama 4 Use fabric to manipulate items or namespaces
宝塔面板命令行帮助教程(包含重置密码)
Qt进程间通信
Idea setting copyright information
Pagoda panel command line help tutorial (including resetting password)
Qt双缓冲绘图
随机推荐
flask项目跨域拦截处理以及dbm数据库学习【包头文创网站开发】
Running error: unable to find or load the main class com xxx. Application
How do programmers finalize nucleic acid statistics with 130 lines of code
Windows2008系统如何切换PHP版本
Chapter 4 is a tutorial on forced filling of in memory objects with IM enabled filling objects (IM 4.7)
uni-app 原生APP-云打包集成极光推送(JG-JPUSH)详细教程
第四章 为IM 启用填充对象之在NO INMEMORY表上指定INMEMORY列属性:示例(IM-4.4 第四部分)
Message queuing overview
为什么要有包装类,顺便说一说基本数据类型、包装类、String类该如何转换?
How Im expressions work (5.3)
Interpretation 3 of gdpr series: how do European subsidiaries return data to domestic parent companies?
【unity笔记】L4Unity中的基础光照
How do traditional enterprises cope with digital transformation? These books give you the answer
第四章 为物化视图启用和禁用IM列存储(IM 4.6)
异步时钟亚稳态 的解决方案——多bit信号
QT draw text
Force buckle - 1137 Nth teponacci number
QT draw image
SPSS之单因素方差分析
软件测试对于减少程序BUG有多大帮助?