Web Firebase setup
This commit is contained in:
parent
7c3a5a1cef
commit
cb71a7ea3a
27
web/firebase-messaging-sw.js
Normal file
27
web/firebase-messaging-sw.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-app-compat.js');
|
||||
importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-messaging-compat.js');
|
||||
|
||||
// This file must be served with "Content-Type: application/javascript" and
|
||||
// placed at the root of the `web/` build output. Flutter web does not copy it
|
||||
// automatically, so ensure you add a manual copy step to your build script or
|
||||
// include it in `web/` before building.
|
||||
|
||||
firebase.initializeApp({
|
||||
// values must match `firebase_options.dart` generated by `flutterfire`
|
||||
apiKey: 'AIzaSyBKGSaHYiqpZvbEgsvJJY45soiIkV6MV3M',
|
||||
appId: '1:173359574734:web:f894a6b43a443e902baa9f',
|
||||
messagingSenderId: '173359574734',
|
||||
projectId: 'tasq-17fb3',
|
||||
authDomain: 'tasq-17fb3.firebaseapp.com',
|
||||
storageBucket: 'tasq-17fb3.firebasestorage.app',
|
||||
});
|
||||
|
||||
const messaging = firebase.messaging();
|
||||
|
||||
messaging.onBackgroundMessage(function(payload) {
|
||||
// display a notification using data in the payload
|
||||
self.registration.showNotification(payload.notification.title, {
|
||||
body: payload.notification.body,
|
||||
data: payload.data,
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user