-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Push Notifications #11651
Comments
- feat(apns): add responders and events for APNS registration and error callbacks - feat(apns): call `registerForRemoteNotifications` within `did_finish_launching` - feat(apns): dispatch event to app for apns registration - feat(apns): gate push notifications behind `push-notifications` feature Relates-To: tauri-apps/tauri#11651 Signed-off-by: Sam Gammon <sam@elide.ventures>
Relates-To: tauri-apps/tauri#11651 Signed-off-by: Sam Gammon <sam@elide.ventures>
- feat(push): relay events for push notifications registration and errors to app - feat(push): gate apns by `push-notifications` feature Relates-To: tauri-apps#11651 Signed-off-by: Sam Gammon <sam@elide.ventures>
- feat: add push notifications plugin - chore: adjust for inline to workspace Relates-To: tauri-apps/tauri#11651 Signed-off-by: Sam Gammon <s@mg.sv>
Relates-To: tauri-apps/tauri#11652 Relates-To: tauri-apps/tauri#11651 Signed-off-by: Sam Gammon <s@mg.sv>
Someone published this undocumented plugin, but no idea if it works or what, haven’t tried it and don’t know anything about how mobile platforms work really. https://github.com/guillemcordoba/tauri-plugin-fcm-push-notifications Hoping that this feature gets added - seems like table stakes for Tauri to be usable for serious mobile apps! |
Not sure the current status of this but @gordongrech claims to have made FCM work on Android and iOS, so sounds like it’s feasible with the plugin system. |
I have managed to get FCM working on Android, attempted IOS but didn't get far for now due to time constraints This person has worked on a FCM plugin before and it seems to be further along on IOS. Haven't tested it myself but it could be useful: |
The blocker right now is iOS, which is structured differently in Tauri's internals than macOS (Mac is much more straightforward to implement). It may indeed be possible to implement some platforms with only a plugin, but Mac and iOS probably need this deeper integration for the reasons outlined in the PR (FCM does not use the same APIs as you guys probably know). I've raised the iOS questions on Tauri's contributor Discord, but so far haven't found any expertise. I think what I will do is split off the iOS changes et. al so they can be worked on in a separate PR. This would mean that macOS and Android, at least, can be delivered here, and then iOS and potentially WNS can follow shortly thereafter, after some advice from whoever wrote the iOS code. |
Also, I'd be happy to collaborate with anyone who is interested. My main hopes right now are to get this PR tree to stable, and to make this entire changeset less invasive by eliminating any changes that can be dropped. |
Nice work on all of this. As someone who is still trying to grasp the Tauri architecture, it might be nice to have a very brief write-up of the different pieces you needed to touch to make this happen (more for educational purposes). While I think all of the PR's are above, there seemed to be a lot of PR's to your personal repo too so it was a little hard to follow. But broadly, nice work! |
Separately and why I am really here... Since this change involves accessing the For example, I am building a banking app and I would like to display a loading / splash screen when the app is re-opened. The documentation I've found says I should hook into the To my knowledge, this is not currently exposed in Tauri. It would be great to be able to redirect to a loading screen and then redirect back when this event is triggered. I'm not trying to suggest that this be included in these changes, but merely that as this change involves the |
Describe the problem
Several platforms supported by Tauri - macOS, iOS, and Android, to name a few - have some kind of built-in push notifications system. For Apple systems, of course there is APNS, and for Android and Firebase-enabled apps, there is FCM.
Tauri isn't yet able to support these APIs, as far as I can tell. On Apple platforms, the developer must register a method with the
AppDelegate
and call a method onNSApplication
, which isn't easy to do from Rust. iOS uses a similar flow, but withUIApplication
instead.Push Notifications are likely to be a common need for Tauri developers, especially on mobile platforms.
Describe the solution you'd like
I think Tauri should add calls to the
UIApplication
and/orNSApplication
to register for push notification support on behalf of the developer; or, Tauri should make available such calls so the developer can implement support themselves.Alternatives considered
{NS,UI}Application
Additional context
General support
In most cases, "registering" for these push systems consists of a few relatively simple steps:
Apple Platforms
macOS
It looks like
tao
already sets up anAppDelegate
, where we would need to callregisterForRemoteNotifications
, and then receive the token at the delegate methodapplication(_:didRegisterForRemoteNotificationsWithDeviceToken:)
.iOS
Nearly identical to macOS, but with
UIApplication.registerForRemoteNotifications()
and the equivalent delegate method.Android
Firebase uses a
Service
on Android to implement messaging within an app. This service is declared in theAndroidManifest.xml
and then implemented within app code; the service:This would be implemented in Kotlin as part of an Android mobile plugin for Tauri. Luckily there are no changes anticipated for
tao
ortauri
itself; Android push can happen through the plugin alone.Windows
Windows apparently has Windows Notifications System (WNS), which is accessible via the
windows
crate. So far it appears to function similar to Android, in that a library can obtain a push channel without special code in the app entrypoint.Linux
I'm not aware of native push infrastructure for Linux. Other SDKs can be used on Linux which do not require instrumentation in the app entrypoint.
The text was updated successfully, but these errors were encountered: