美文网首页
flutter极光推送-集成华为厂商通道

flutter极光推送-集成华为厂商通道

作者: Kac0 | 来源:发表于2020-08-27 23:54 被阅读0次

可参考根据极光提供的厂商api文档

https://www.yuque.com/docs/share/307d6d68-0cc2-41b6-935b-4ca8c77c63d5#HCxMk

集成前注意:请先查看你的极光推送版本是多少,后续教程中极光华为jar包建议和极光推送版本相近的

我的是jpush 3.7.0版本,使用cn.jiguang.sdk.plugin:huawei:3.6.8

step1:使用jcenter集成方式集成极光华为jar包和华为推送插件,在应用层build.gradle,也就是android/app/build.gradle中添加

dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    //华为推送证书添加

    implementation 'cn.jiguang.sdk.plugin:huawei:3.6.8'

    implementation 'com.huawei.hms:push:4.0.2.300'

}

//华为推送证书添加

apply plugin: 'com.huawei.agconnect'

step2.把在华为开发者注册应用后,获得agconnect-services.json文件放置到/Android/app/目录下

step3.在项目层build.gradle,就是android/build.gradle中添加极光插件和华为仓库

buildscript {

    ext.kotlin_version = '1.3.50'

    repositories {

        google()

        jcenter()

        //华为推送证书添加

        maven {url 'http://developer.huawei.com/repo/'}

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:3.5.0'

        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        //华为推送证书添加

        classpath 'com.huawei.agconnect:agcp:1.2.1.301'

    }

}

allprojects {

    repositories {

        google()

        jcenter()

        //华为推送证书添加

        maven {url 'http://developer.huawei.com/repo/'}

    }

}

step4在android/app/build.gradle中添加jks证书,不懂证书签名的看

https://www.cnblogs.com/zifayin/p/12863516.html

//华为推送证书添加

    signingConfigs {

        release {

            storeFile file("key/key.jks")//签名文件的path

            storePassword "123456"

            keyAlias "key"

            keyPassword "123456"

        }

    }

    buildTypes {

        release {

            //华为推送证书添加

            minifyEnabled true

            proguardFiles 'proguard-rules.pro'

            signingConfig signingConfigs.release

        }

        debug{

            minifyEnabled false

            signingConfig signingConfigs.release

        }

    }

最后 把jks的sha256回填到华为开发者应用设置,详细看

https://developer.huawei.com/consumer/cn/doc/development/HMS-Guides/game-preparation-v4#certificate

如果后面报错,在AndroidManifest.xml添加xmlns:tools="http://schemas.android.com/tools"

<manifest .......

xmlns:tools="http://schemas.android.com/tools"

   .....>

和tools:replace="android:label"

<application .....

      添加  tools:replace="android:label"

....>

相关文章

网友评论

      本文标题:flutter极光推送-集成华为厂商通道

      本文链接:https://www.haomeiwen.com/subject/jfkksktx.html