honor_push 0.0.1
honor_push: ^0.0.1 copied to clipboard
Lightweight Flutter plugin for honor push integration. Simplifies push notifications on honor devices, supporting token registration, message receiving, and callback handling.
honor_push #
honor 推送API (honor push)
一个轻量级 Flutter 插件,用于集成 honor 推送 API。它简化了 honor 手机平台的推送通知开发,支持 token 注册、消息接收和回调处理。
Usage #
-
在Android/build.gradle.kts添加:
buildscript { repositories { google() mavenCentral() maven { url = uri("https://developer.hihonor.com/repo") } } dependencies { classpath("com.android.tools.build:gradle:8.7.3") classpath("com.hihonor.mcs:asplugin:2.0.1.300") } } -
在Android/app/build.gradle.kts添加:
plugins { ... id("com.hihonor.mcs.asplugin") } -
从荣耀后台下载mcs-services.json,放置于android/app 目录下
-
在pubspec.yaml添加:
honor_push: app_id: 'your app id' -
业务逻辑
import 'package:honor_push/honor_push.dart';
final honorPushPlugin = HonorPush();
await honorPushPlugin.initialize();
final resp = await honorPushPlugin.getToken();
final regId = resp.token;
Additional information #
具体参考:honor客户端API接口文档