official_push_pulgin 0.0.5 copy "official_push_pulgin: ^0.0.5" to clipboard
official_push_pulgin: ^0.0.5 copied to clipboard

outdated

This is a Plug-ins pushed by the manufacturer

official_push_pulgin #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android.

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

该插件支持oppo、vivo、honour、xiaomi推送 先在只是把推送注册完成之后的regId(token)回调回来了,其它的功能未做

一、使用方法及功能: 1.pubspec.yaml增加依赖 official_push_pulgin: ^xxxx

2.在flutter项目的android目录下的build中添加如下配置: 2.1 在buildscript中添加 repositories { maven { url 'https://developer.hihonor.com/repo/' } maven { url 'https://raw.githubusercontent.com/ggvle/pushLib/tree/main/'} } 2.2 在allprojects中添加 repositories { maven { url 'https://developer.hihonor.com/repo/' } maven { url 'https://raw.githubusercontent.com/ggvle/pushLib/tree/main/'} }

3.在flutter项目的android/app/build中defaultConfig里面添加如下配置: manifestPlaceholders += [ VIVO_APPKEY : "9c29fe5f-ea67-46d3-951f-81da78d2c029", VIVO_APPID : "10000", // HONOUR_APPID: "11111111", ]

3.如果应用开启混淆请参考各推送官网混淆配置

4.初始化注册推送 请根据不同的设备设备类型选择调用不同的初始化 1.1 oppo ## oppo官网推送平台申请的appSecret、appKey以及needLog是否需要开启推送相关日志 PushManager.initOppoPush(appSecret: "sK8dkfTwHt11QezBuIO4kjJV", appKey: "67ZtaSY1EyjZZoYqqYVT6e3X",needLog: true); 1.2 xiaomi ## 小米官网推送平台申请的appId、appKey PushManager.initXiaomiPush(appId: "1000270", appKey: "670100056270"); 1.3 vivo PushManager.initVivoPush(); 1.4 honour ## initToken 是否初始化注册成功后返回推送regId PushManager.initHonourPush(initToken: true);

5.在需要获取推送regId的地方注册监听 PushListener( PushManager.channel, listener: (PushModel? model) {

        },
    );
返回的model包含推送类型(type)、推送regId(regId)、推送信息json字符串(pushReceiverFunJsonStr) 注意都可为null

6.主动获取regId 参数为推送类型 其中小米、vivo会直接返回,oppo、honour回调中获取到 await PushManager.getRegId(PushType.xiaomi);