Skip to content

Show sealed previews on Android, opened by the app itself - #322

Merged
sivert-io merged 1 commit into
mainfrom
claude/GRYT-1698-android-previews
Oct 8, 2026
Merged

sivert-io merged 1 commit into
mainfrom
claude/GRYT-1698-android-previews

Conversation

@sivert-io

@sivert-io sivert-io commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Android notifications show who wrote, where, and the first line, the same as on iPhone (GRYT-1698).

How. The relay (push#4) sends a phone that registered with opens: true data-only messages. Android doesn't show those by itself. It wakes the app, which builds the notification:

  • index.ts loads src/notify/androidPushTask.ts before the router. It defines a task for expo-notifications' registerTaskAsync, and Android runs it for a data-only push with the app in the foreground, the background or closed.
  • The task finds the server's preview key by the relay's tag, opens the preview with openPreview, and shows a local notification: who wrote as the title, where as the subtext, the line as the body, and the tag in its data so a tap opens the right server. If it can't open the preview, it shows the relay's fixed text instead.
  • openPreview reads the same format as the iPhone extension (AES-256-GCM, gryt-push-1|<tag> as additional data), using @noble/ciphers. Its test seals the way the server does.

Registration. Android now registers with opens: true. A capability made before this was registered without it, so the phone swaps it once (opens in the push state). That also means a new preview key, which the server picks up on the next push:register.

New dependencies: expo-task-manager ~57.0.21 (a native module, so this needs a new build) and @noble/ciphers ^2.4.0.

Tested on the Android emulator (Pixel 7, API 36) against the live relay with push#4 deployed, a local server and the web client:

  • App in the background (dev build): the notification read Cinder, subtext #General · Gryt Blog Demo, text Android preview test: who, where and this line.
  • App closed (release build, process killed): Android started it, the task ran headless in about a second, and the same notification showed for Third test, release build, app closed.
  • The relay stored the phone with opens = 1.

Look at:

  • With the app closed, the dev build's launcher crashes on start (SplashScreenManager not found) before the task can run, so test that case with a release build.
  • expo-task-manager is required inside a try, on Android only, so an iPhone or an old dev client without the native module doesn't crash on start.
  • A force-stopped app ("Force stop" in Android settings) gets no FCM at all, same as any app.

🤖 Generated with Claude Code

The relay sends data-only messages to phones that register with opens, and a background task opens the preview and shows the notification, falling back to the fixed text (GRYT-1698).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sivert-io
sivert-io merged commit e196c6e into main Oct 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant