对接jpush

hmxc
小赖 4 years ago
parent 44041790f7
commit 2c20751260

@ -46,6 +46,11 @@ android {
applicationId "com.akucommunity.aku_community_manager"
minSdkVersion 21
targetSdkVersion 29
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "99067fe33fa04aad88c3acac", //appkey.
JPUSH_CHANNEL : "developer-default", //.
]
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

@ -11,12 +11,34 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:provider/provider.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await AmapCore.init('');
await AmapLocation.instance.init(iosKey: '');
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: "99067fe33fa04aad88c3acac",
channel: "developer-default",
production: false,
debug: true, // debug
);
runApp(MyApp());
}
@ -34,7 +56,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (context) => OutdoorProvider()),
ChangeNotifierProvider(create: (context) => GreenManageProvider()),
ChangeNotifierProvider(create: (context) => InspectionManageProvider()),
ChangeNotifierProvider(create: (context)=>AnouncementProvider()),
ChangeNotifierProvider(create: (context) => AnouncementProvider()),
],
child: GetMaterialApp(
title: '小蜜蜂管家',

@ -310,6 +310,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
jpush_flutter:
dependency: "direct main"
description:
name: jpush_flutter
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.3"
logger:
dependency: "direct main"
description:

@ -59,6 +59,7 @@ dependencies:
hive: ^1.4.4+1
hive_flutter: ^0.3.1
jpush_flutter: ^0.6.3
dev_dependencies:
flutter_test:

Loading…
Cancel
Save