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.
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/or NSApplication 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
1) I looked for plugins and found none
2) I looked for easy Rust bindings to register for APNS, and found none because these APIs use {NS,UI}Application
3) I looked into alternative push systems (3rd-party), but these aren't integrated well with underlying operating systems like Android and iOS, as compared to native push infrastructure
Additional context
General support
In most cases, "registering" for these push systems consists of a few relatively simple steps:
1) "Registering" or "requesting" a token from the application, using system APIs, potentially within the app entrypoint
2) "Receiving" the token via some callback or delegate mechanism (the token is typically just some raw bytes or a string)
3) Making the received token available to the developer
Usually the developer will want to send this token to a server
Callbacks or even just a method to retrieve the latest push token (if any) would work fine for callers, probably
Firebase uses a Service on Android to implement messaging within an app. This service is declared in the AndroidManifest.xml and then implemented within app code; the service:
Requests a token
Receives the token/receives updated tokens
Receives pushed messages directed to the app
This would be implemented in Kotlin as part of an Android mobile plugin for Tauri. Luckily there are no changes anticipated for tao or tauri 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.
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
1) I looked for plugins and found none 2) I looked for easy Rust bindings to register for APNS, and found none because these APIs use
{NS,UI}Application
3) I looked into alternative push systems (3rd-party), but these aren't integrated well with underlying operating systems like Android and iOS, as compared to native push infrastructureAdditional context
General support
In most cases, "registering" for these push systems consists of a few relatively simple steps:
1) "Registering" or "requesting" a token from the application, using system APIs, potentially within the app entrypoint 2) "Receiving" the token via some callback or delegate mechanism (the token is typically just some raw bytes or a string) 3) Making the received token available to the developer
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.