34 lines
857 B
Dart
34 lines
857 B
Dart
import 'package:jpush_flutter/jpush_flutter.dart';
|
|
|
|
class JPushProvider {
|
|
final JPush jpush = JPush();
|
|
|
|
Future<void> initJPush() async {
|
|
jpush.setup(
|
|
appKey: "7ff37d174c1a568a89e98dad",
|
|
channel: "flutter_channel",
|
|
production: false,
|
|
debug: true,
|
|
);
|
|
|
|
jpush.applyPushAuthority(const NotificationSettingsIOS(
|
|
sound: true,
|
|
alert: true,
|
|
badge: true,
|
|
));
|
|
|
|
// // Add event handler
|
|
// jpush.addEventHandler(
|
|
// onReceiveNotification: (Map<String, dynamic> message) {
|
|
// print("Receive notification: $message");
|
|
// },
|
|
// onOpenNotification: (Map<String, dynamic> message) {
|
|
// print("Open notification: $message");
|
|
// },
|
|
// onReceiveMessage: (Map<String, dynamic> message) {
|
|
// print("Receive message: $message");
|
|
// },
|
|
// );
|
|
}
|
|
}
|