fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.92k stars 1.38k forks source link

Add support for push notifications #3656

Open andydotxyz opened 1 year ago

andydotxyz commented 1 year ago

Checklist

Is your feature request related to a problem?

Notifications are only local and the app must be running to send them

Is it possible to construct a solution with the existing API?

Technically possible with CGo, but not exposed or taken care of in Fyne API.

Describe the solution you'd like to see.

As mentioned in #1844 apps should be able to register for push notifications.

andydotxyz commented 1 year ago

As noted by @Gys the following info should be helpful:


@andydotxyz Push Notifications are an OS thing in both iOS and Android. Upon registering with the OS a unique identifier is released which needs to be send to the app back end. The back end then uses the id with some service provider to send a push notification specifically to that one person's app. Optionally with some payload, sound, etc. Without a payload it becomes a silent notifications which enabled the app to do some silent background processing (but this can be overruled by the OS or user).

An article explaining the registration: https://www.swiftlyrush.com/push-notifications-in-ios/

I have a React Native mobile app that uses push notifications. It uses the free tier of OneSignal (https://onesignal.com/mobile-push). OneSignal provides a local React Native iOS/Android library (among others) integrated with their service. This makes adding Push Notifications very easy.

A push service can also be self hosted, for example with this one written in Golang: https://github.com/appleboy/gorush

Alternatively it might be possible to make a kind of js bridge to use Capacitor: an open source native framework created by Ionic which implements many more native features like camera, motion, geolocation, local notifications and push notifications (https://ionicframework.com/docs/native/push-notifications). Or, just going wild here, maybe it is possible to directly connect to the native code used by Capacitor (https://github.com/ionic-team/capacitor-plugins/tree/main/push-notifications/ios).