一、配置极光开发者

1.注册极光开发者

https://www.jiguang.cn/push

2.创建应用

二、创建APP

1.添加依赖

pubspec.yaml  添加: flutter_jpush: ^0.0.4

2.android 专属配置

    defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "xxx"
minSdkVersion
targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64' // 'arm64-v8a',
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL : "developer-default",//你的推送渠道,如果不知道填写developer-default即可
]
}

3.编写代码

import 'package:flutter/material.dart';
import 'package:flutter_jpush/flutter_jpush.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
} class _MyAppState extends State<MyApp> { void initState(){
super.initState();
_initJPush();
_initNotification();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: Text('data'),
)),
);
} //初始化
void _initJPush() async {
await FlutterJPush.startup();
print("初始化jpush成功"); // 获取 registrationID
var registrationID = await FlutterJPush.getRegistrationID();
print(registrationID); // 注册接收和打开 Notification()
_initNotification();
}
//初始化
void _initNotification() async {
FlutterJPush.addReceiveNotificationListener(
(JPushNotification notification) {
print("收到推送提醒: $notification");
}); FlutterJPush.addReceiveOpenNotificationListener(
(JPushNotification notification) {
print("打开了推送提醒: $notification");
});
}
}

测试

推送通知

注意:android一定要加上包名,而且一旦确认不能更改

flutter 极光推送的更多相关文章

  1. JPush Flutter Plugin(Futter推送-极光推送)

    https://pub.flutter-io.cn/packages/jpush_flutter JPush's officially supported Flutter plugin (Androi ...

  2. Flutter接入极光推送

    (1)搜索 https://pub.dartlang.org/packages/jpush_flutter ,安装插件,并且按照官方配置 /android/app/build.gradle andro ...

  3. Flutter中极光推送的使用----jpush_flutter

    原文地址:https://www.cnblogs.com/niceyoo/p/11095994.html 1.申请极光账号和建立应用 极光推送的官方网址为:https://www.jiguang.cn ...

  4. 68-Flutter中极光推送的使用

    1.申请极光账号和建立应用 极光推送的官方网址为:https://www.jiguang.cn/ 注册好后,进入'服务中心',然后再进入'开发者平台',点击创建应用. 这时候会出现新页面,让你填写“应 ...

  5. 使用极光推送(www.jpush.cn)向安卓手机推送消息【服务端向客户端主送推送】C#语言

    在VisualStudio2010中新建网站JPushAndroid.添加引用json帮助类库Newtonsoft.Json.dll. 在web.config增加appkey和mastersecret ...

  6. 用JPUSH极光推送实现服务端向安装了APP应用的手机推送消息(C#服务端接口)

    这次公司要我们做一个功能,就是当用户成功注册以后,他登录以后要收到消息,当然这个消息是安装了我们的手机APP应用的手机咯. 极光推送的网站的网址是:https://www.jpush.cn/ 极光推送 ...

  7. 极光推送-适配 iOS10

    //************************ iOS10 适配 **************************// //************************ 11/02/20 ...

  8. iOS推送(利用极光推送)

    本文主要是基于极光推送的SDK封装的一个快速集成极光推送的类的封装(不喜勿喷) (1)首先说一下推送的一些原理: Push的原理: Push 的工作机制可以简单的概括为下图 图中,Provider是指 ...

  9. 极光推送JPush的快速集成

    首先到极光推送的官网上创建一个应用,填写对应的应用名和包名. 创建好之后下载Demo 提取Sdk里面的图片和xml等资源文件放自己项目的相应位置,然后要注意的是.so文件的放置位置: 在main目录下 ...

随机推荐

  1. 【SQLAlchemy】SQLAlchemy技术文档(中文版)(中)

    10.建立联系(外键) 是时候考虑怎样映射和查询一个和Users表关联的第二张表了.假设我们系统的用户可以存储任意数量的email地址.我们需要定义一个新表Address与User相关联. from ...

  2. oracle补充

    索引 索引是若干数据行的关键字的列表,查询数据时,通过索引中的关键字可以快速定位到要访问的记录所在的数据块,从而大大减少读取数据的I/O次数,因此可以显著的提高性能 创建索引的SQL 把下面表中的na ...

  3. [UOJ #52]【UR #4】元旦激光炮

    题目大意:交互题,给你三个有序数组,长度分别为$n\_a,n\_b,n\_c$,都不超过$10^5$.三个函数$get\_a(i),get\_b(i),get\_c(i)$,分别返回$a_i,b_i, ...

  4. [NOI2017 D1T1]整数

    题目大意:有一个整数 $x$ ,一开始为 $0$ .有 $n$ 个操作,有两种类型: $1 \;a\; b$:将 $x$ 加上整数 $a\cdot 2^b$ ,其中 $a$ 为一个整数, $b$ 为一 ...

  5. iconfont字体图标

    1.1.进入阿里图标网站 http://www.iconfont.cn/ 1.2.在购物车里添加自己需要的字体图标 1.3.下载代码 1.4.解压过后,找到iconfont.css,放在你的项目里,需 ...

  6. 修改nginx对http请求数据大小限制

    1. 问题发现 在公司搭建了一个基于mindoc的wiki知识库,用nginx做的反向代理服务器,同事在使用过程中上传某个文件一直失败,于是看着看下mindoc自己的日志文件,发现都是类似于fastd ...

  7. codeforces 854 problem E

    E. Boredom Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time t ...

  8. JGroups 初探

    最近研究 JAVA 集群技术,看到 jgroups 这个框架,网上有些例子,非常简单.可以参考其官方网址:http://www.jgroups.org/manual/index.html按捺不住,自己 ...

  9. linux软件管理(Vim编辑器使用) ——(七)

    windows : .exe     安装 .卸载 安装:  mysql.exe  cc.exe 卸载 : 该软件唯一的标识  ,包名   alibaba android : *.apk   卸载 包 ...

  10. python3,循环,方法练习2

    1:编写for循环,利用索引遍历出每一个字符 msg = 'hello egon 666' msg = 'hello egon 666' i = 0 for i in range(0, len(msg ...