Add android fallback for background push notifications #102

Merged
hodlbod merged 1 commits from background-push into dev 2026-03-19 15:32:32 +00:00
Owner

@mplorentz take a quick gander if you would. Fixes #86

@mplorentz take a quick gander if you would. Fixes https://gitea.coracle.social/coracle/flotilla/issues/86
hodlbod added 1 commit 2026-03-17 19:48:41 +00:00
hodlbod requested review from mplorentz 2026-03-17 19:48:41 +00:00
mplorentz reviewed 2026-03-19 15:05:39 +00:00
mplorentz left a comment
Collaborator

My eyes glazed over after a bit of reading this code 😬 but I learned some things. I wish I could test it but I flashed stock android back onto my test device recently. I am expecting another Android phone in the mail soon though that I'm intending to put Graphene on so maybe I can give it a shot then.

My eyes glazed over after a bit of reading this code 😬 but I learned some things. I wish I could test it but I flashed stock android back onto my test device recently. I am expecting another Android phone in the mail soon though that I'm intending to put Graphene on so maybe I can give it a shot then.
@@ -0,0 +68,4 @@
val workManager = WorkManager.getInstance(context)
val periodic = PeriodicWorkRequest.Builder(
Collaborator

Very cool. I know the iOS incantation to do a similar thing if we ever want to support it in the future. It seems less important because there is no version of iOS without APNS but it would be useful for privacy nerds and relays that don't play nicely with a push server. (I forget how the successor to anchor plays with generic NIP-29 relays, but it requires some configuration by someone, I assume).

Very cool. I know the iOS incantation to do a similar thing if we ever want to support it in the future. It seems less important because there is no version of iOS without APNS but it would be useful for privacy nerds and relays that don't play nicely with a push server. (I forget how the successor to anchor plays with generic NIP-29 relays, but it requires some configuration by someone, I assume).
Author
Owner

Yeah, the relay has to support relay push, but that's a pretty low bar for making apns work.

Yeah, the relay has to support [relay push](https://github.com/nostr-protocol/nips/pull/2194), but that's a pretty low bar for making apns work.
hodlbod marked this conversation as resolved
@@ -0,0 +203,4 @@
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
val body = "New activity"
Collaborator

I've been wondering lately how hard it would be to put some information about the new activity (like author or content) in the notification. But now I see that you've like reimplemented a whole relay service from scratch in Kotlin 😮, so it would not be trivial at all to fetch the authors relay list, then fetch profile metdata to grab the author's name and photo.

Is there no good way to call back into the capacitor javascript to do this relay communication?

I've been wondering lately how hard it would be to put some information about the new activity (like author or content) in the notification. But now I see that you've like reimplemented a whole relay service from scratch in Kotlin 😮, so it would not be trivial at all to fetch the authors relay list, then fetch profile metdata to grab the author's name and photo. Is there no good way to call back into the capacitor javascript to do this relay communication?
Author
Owner

No, the non-webview js runtime is very limited, in particular it has no support for websockets. So it was either write native code, or use an http-based relay proxy. I tried the latter briefly but it was a nightmare for AUTH etc. So I went with vibe-coded, nasty kotlin instead.

Adding more information wouldn't be too hard, it would just require a bunch more gross kotlin code. The relay push nip has an include_event option too, which would relay the event to the push server so that it has the content and pubkey too. I left that out for privacy purposes, but it would be easy to turn on.

No, the non-webview js runtime is very limited, in particular it has no support for websockets. So it was either write native code, or use an http-based relay proxy. I tried the latter briefly but it was a nightmare for AUTH etc. So I went with vibe-coded, nasty kotlin instead. Adding more information wouldn't be too hard, it would just require a bunch more gross kotlin code. The relay push nip has an `include_event` option too, which would relay the event to the push server so that it has the content and pubkey too. I left that out for privacy purposes, but it would be easy to turn on.
hodlbod merged commit 0761cdd28f into dev 2026-03-19 15:32:32 +00:00
hodlbod deleted branch background-push 2026-03-19 15:32:33 +00:00
Sign in to join this conversation.