123456789101112131415161718192021222324252627282930313233 |
- import 'package:jpush_flutter/jpush_flutter.dart';
- import 'package:lszlgl/config/app_config.dart';
- class JGPushService{
- static final JPush jPush = JPush();
- static Future<void> jgInit(AppEnvironment env) async{
- jPush.setup(
- // 极光推送 正式环境appkey需要再申请
- appKey: env == AppEnvironment.product ? '???' : '2f42e3db4d0083b0bc5a3f6c',
- channel: 'developer-default',
- production: env == AppEnvironment.product ? true : false,
- debug: env == AppEnvironment.develop ? true : false
- );
- 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");
- },
- );
- }
- }
|