集成jpush

hmxc
小赖 4 years ago
parent d97cc8aa31
commit 405b63b885

@ -49,6 +49,12 @@ android {
targetSdkVersion 28 targetSdkVersion 28
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "6a2c6507e3e8b3187ac1c9f9",
JPUSH_CHANNEL : "developer-default",
]
} }
signingConfigs { signingConfigs {

@ -8,6 +8,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_picker/flutter_picker.dart'; import 'package:flutter_picker/flutter_picker.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -21,6 +22,27 @@ import 'package:akuCommunity/utils/developer_util.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
JPush jpush = new JPush();
jpush.addEventHandler(
//
onReceiveNotification: (Map<String, dynamic> message) async {
print("flutter onReceiveNotification: $message");
},
//
onOpenNotification: (Map<String, dynamic> message) async {
print("flutter onOpenNotification: $message");
},
//
onReceiveMessage: (Map<String, dynamic> message) async {
print("flutter onReceiveMessage: $message");
},
);
jpush.setup(
appKey: "6a2c6507e3e8b3187ac1c9f9",
channel: "developer-default",
production: false,
debug: true, // debug
);
DeveloperUtil.setDev(true); DeveloperUtil.setDev(true);
runApp(MyApp()); runApp(MyApp());
} }

@ -609,6 +609,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.4" version: "0.3.4"
jpush_flutter:
dependency: "direct main"
description:
name: jpush_flutter
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.3"
js: js:
dependency: transitive dependency: transitive
description: description:

@ -95,6 +95,7 @@ dependencies:
git: git:
url: http://192.168.2.201:8099/aku_fe/power_logger.git url: http://192.168.2.201:8099/aku_fe/power_logger.git
flutter_rating_bar: ^3.2.0+1 flutter_rating_bar: ^3.2.0+1
jpush_flutter: ^0.6.3
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save