项目作者: jpush

项目描述 :
JPush's officially supported Flutter plugin (Android & iOS). 极光推送官方支持的 Flutter 插件(Android & iOS)。
高级语言: Dart
项目地址: git://github.com/jpush/jpush-flutter-plugin.git


QQ Group

JPush Flutter Plugin

flutter 2.0 请切换至 dev-2.x 分支。

安装

在工程 pubspec.yaml 中加入 dependencies

  1. //github 集成
  2. dependencies:
  3. jpush_flutter:
  4. git:
  5. url: git://github.com/jpush/jpush-flutter-plugin.git
  6. ref: master
  7. // pub 集成
  8. dependencies:
  9. jpush_flutter: 2.1.4

配置

Android:

/android/app/build.gradle 中添加下列代码:

  1. android: {
  2. ....
  3. defaultConfig {
  4. applicationId "替换成自己应用 ID"
  5. ...
  6. ndk {
  7. //选择要添加的对应 cpu 类型的 .so 库。
  8. abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a',
  9. }
  10. manifestPlaceholders = [
  11. JPUSH_PKGNAME : applicationId,
  12. JPUSH_APPKEY : "appkey", // NOTE: JPush 上注册的包名对应的 Appkey.
  13. JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
  14. ]
  15. }
  16. }
iOS:
  • 在 xcode8 之后需要点开推送选项: TARGETS -> Capabilities -> Push Notification 设为 on 状态

使用

  1. import 'package:jpush_flutter/jpush_flutter.dart';

APIs

注意 : 需要先调用 JPush.setup 来初始化插件,才能保证其他功能正常工作。

参考