ben-xD / push

Push notifications in Flutter without firebase_messaging.
https://pub.dev/packages/push
37 stars 23 forks source link

Proposal: provide alternative to FCM using Serverpod #17

Closed lukehutch closed 1 year ago

lukehutch commented 1 year ago

Serverpod proposes to add its own push messaging solution: https://github.com/serverpod/serverpod/issues/439

I would love to see a solution for Android that doesn't require FCM, but instead pairs your push library with Serverpod as the push notification server.

Do you have any interest in working on something like that, or potentially collaborating on this project?

I can probably contribute some work on Serverpod, but I don't know the client side of push notifications.

ben-xD commented 1 year ago

Hey @lukehutch, I don't think it is viable to compete with FCM on Android, because of Android's restrictions/limitations. Serverpod could use UnifiedPush, but Android apps would need a persistent notification (forever showing) in the notification tray. I suspect this is unacceptable for most apps, so it's a feature that's not worth doing.

I hope UnifiedPush progresses though, but IMHO Google and Android has full control over it's fate on vanilla Android.

This might still be useful feature for Android forks though, like LineageOS. In that case we would need to add support for UnifiedPush in this package.

lukehutch commented 1 year ago

@ben-xD There is also Web Push, which should get around this limitation of UnifiedPush. However a Flutter app would have to add a JS service worker. I'm not sure how easy that is, but I'll take a look.

ben-xD commented 1 year ago

JavaScript running in Flutter won't have as much functionality as if running in a full browser. The browser actually implements the Web Push API.

Also, browsers implement web push using APNs on iOS (e.g. Safari https://webkit.org/blog/13878/web-push-for-web-apps-on-ios-and-ipados/) and FCM on Android, so they follow the same rules.

iOS:

Web Push on iOS and iPadOS uses the same Apple Push Notification service that powers native push on all Apple devices.

Firefox, on iOS and Android https://mozilla-services.github.io/autopush-rs/install.html#configuring-for-third-party-bridge-services

How we connect and use these systems is described in the following documents:

Apple Push Notification service (APNs) Google's Fire Cloud Messaging service (FCM)

Alternatively you could send notifications to your web app, but that wouldnt reach your flutter app. It certainly won't be able to communicate freely between your web app and Flutter app.

ben-xD commented 1 year ago

I'll close this for now as I don't think it's actionable due to the limitations I mentioned.