You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
justMusic/Sources/justMUSIC/lib/services/NotificationService.dart

18 lines
617 B

import 'package:firebase_messaging/firebase_messaging.dart';
class NotificationService {
final _firebaseMessaging = FirebaseMessaging.instance;
Future<void> handleBackgroundMessage(RemoteMessage message) async {
print('Title: ${message.notification?.title}');
print('Body: ${message.notification?.body}');
print('Payload: ${message.data}');
}
Future<void> initNotifications() async {
await _firebaseMessaging.requestPermission();
final token = await _firebaseMessaging.getToken();
print("Grrrpaw:"+token!);
//FirebaseMessaging.onBackgroundMessage(handleBackgroundMessage);
}
}