1

Is there any way to send "data messages", i.e. messages that don't trigger a notification, using Firebase on Flutter Web?

The reason I want to do this is that I am developing an app intended to be run in a custom desktop program with a Chromium-based browser which doesn't seem to have any way of granting notification permission.

It seems a bit counter intuitive that the notification permission would be needed to deliver data/background messages that don't trigger any notification. But if I try to run the app without requesting permission, I get

[firebase_messaging/permission-blocked] Messaging: The notification permission was not granted and blocked instead. .
    at Object.e (https://example.com/main.dart.js:4363:3)
    at https://example.com/main.dart.js:51335:9
    at aMr.a (https://example.com/main.dart.js:5569:62)
    at aMr.$2 (https://example.com/main.dart.js:43491:14)
    at aLa.$2 (https://example.com/main.dart.js:43488:16)
    at Object.aMb (https://example.com/main.dart.js:5818:18)
    at YO.<anonymous> (https://example.com/main.dart.js:105384:70)
    at a0u.KX (https://example.com/main.dart.js:44590:12)
    at ni.atq (https://example.com/main.dart.js:43756:18)
    at aEx.$0 (https://example.com/main.dart.js:43905:37)

when trying to get the FCM token

fcmID = await fCM.getToken();

Since the custom browser desktop program doesn't support requesting the notification permission from the user (even though it is using a modern Chromium component), I get the same error even if trying to request permission.

Magnus
  • 17,157
  • 19
  • 104
  • 189

0 Answers0