Skip to main content

supabase_realtime_push 0.1.0 copy "supabase_realtime_push: ^0.1.0" to clipboard
supabase_realtime_push: ^0.1.0 copied to clipboard

PlatformAndroid

Push notifications on Android without Firebase: a native service holds one Supabase Realtime connection and shows the notifications your database lists.

Changelog #

0.1.0 - 2026-12-01 #

  • Lock screen privacy: a snapshot notification with "lockScreen": "hidden" stays off a secure lock screen; "redacted" shows only its publicTitle there ("New message") when the user hides sensitive content, and during screen sharing on Android 15+. Any other value counts as "hidden". A failed reply reposts it just as private. The inbox sets neither.
  • lastError(): the service's latest failure (a snapshot that failed, a connection refused before it joined, the foreground refused) and when it happened, or null once a snapshot works. It tells an app why nothing arrives while status() says running, without adb logcat.
  • The service reconnects as soon as the network comes back or changes (Wi-Fi to mobile data), instead of waiting up to 30 s for the next retry. The plugin now declares ACCESS_NETWORK_STATE.
  • setFocus(id): while the app is on screen, the notification the user is looking at (the open chat, for instance) leaves the shade and does not ring; it comes back quietly if still unread once they leave.
  • The periodic check reads the snapshot with the screen on too, so a broadcast Realtime dropped while the socket stayed up no longer leaves the shade stale.
  • The large icon cache holds a full default snapshot (20 icons at the largest screen density). With more icons than it held, every snapshot downloaded them all again, and some were posted without their picture.
  • A notification posted without its large icon (the download failed or ran out of time) gets it with a later snapshot, quietly. A URL that failed is tried again after 10 minutes instead of on every snapshot.
  • realtime_push.sql: deleting a device row (unregister, the user deleted) signals that device, so the phone clears its notifications and stops at once instead of at its next snapshot read. Run the script again to get it.
  • A failed reply keeps the launcher badge number on the "Not sent" repost.
  • A channel removed from start(channels: ...) is deleted from the app's notification settings; listing it again brings back the user's settings.
  • The Reply action and the "Not sent" header come in Portuguese, Spanish, French, German and Italian too. An app still overrides them, or adds another language, with the same string names in its own resources.
  • The default channel name and "connected" notification follow the phone's language, in the same languages as Reply: start's channelName, connectedTitle and connectedText now default to null, which means the plugin's string resources. A string passed to start still wins. A config saved by an older version keeps its English names until the app calls start again.
  • README: a trigger on a messages table that calls realtime_push_send, checked by the SQL tests.
  • After Android killed the app in the background, opening it again from the launcher no longer returns the old tap from launchTap(), so the app does not navigate to that notification a second time.
  • The reconnect backoff grows even when each attempt joins: a server that accepted the join and dropped the socket soon after got a reconnect, a join and a snapshot about every second while the screen was on.
  • After three refusals in a row (socket failed HTTP 429, the Realtime connection limit, or join refused, public channels turned off) the service waits 5 minutes before reconnecting instead of up to 30 s, and the periodic check reads the snapshot meanwhile. A fleet above the limit no longer keeps the server full with retries in waves. The screen turning on or a network change still reconnects at once.
  • A snapshot cut short when Android stops the service no longer rings again for what it had already posted.
  • A notification pushed out of the snapshot by newer ones that comes back at the same revision no longer rings again, nor returns after the user swiped it away.
  • A late dismissal of an older revision (the old tap intent after Android killed the app, or a swipe that lands after a newer revision was posted) no longer removes the newer notification from the shade.
  • A tap that arrives while nothing listens to taps (the app subscribes after a sign-in screen, or the listening widget was disposed) is no longer lost: the next launchTap() returns it.
  • A snapshot entry's optional "time" (milliseconds since the epoch) shows when the notification arrived, next to its title. The default realtime_push_snapshot_for sends each row's created_at; running the script again keeps an existing one, so an install that never replaced it gets the time by dropping it first: drop function public.realtime_push_snapshot_for(uuid);, then the script.
  • A snapshot still in flight when the user signed out, and in as someone else, is ignored: it could mark the new pair rejected or show the previous account's notifications.
  • realtime_push_send takes a null body, data or silent as its default instead of raising, so a trigger passing a null column no longer rolls back the write it runs in. Run the script again to get it.
  • New PushStatus.unregistered: this install has no device pair (never started, restored from a backup, or stop(forgetDevice: true)). stopped now means only "turned off by stop()", so an app that restarts the service on launch no longer undoes a user's off switch. A switch over PushStatus needs the new case.
  • start with an http:// URL whose host Android blocks cleartext traffic to (the default for apps targeting Android 9+) throws bad_arguments with how to allow it, instead of starting a service that never connects.
  • areNotificationsEnabled() tells whether the user turned off the app's notifications or its messages channel, without prompting, and openNotificationSettings() opens the app's notification settings.
  • Limits on the snapshot (contract §3): the device reads at most 1 MB of it, keeps the first 50 notifications, and drops one whose data is over 4 KB. A snapshot of hundreds of entries held the shade for minutes, so a swipe meanwhile made Android kill the app; a large data made every later snapshot ring again for everything. One notification that fails to post no longer stops the others from being remembered. The README's "Your own data" example now has limit 20.
  • "Mark as read" on the notification: a snapshot entry with "markRead": true gets the action, which removes it at once, like a swipe, and calls the new realtime_push_read, which hands the id to your realtime_push_read_for. The default reads the inbox rows of that key, so it leaves every device, and the inbox snapshot offers the action. Run the script again for the new functions; the inbox snapshot offers it once realtime_push_snapshot_for is dropped and recreated, as for "time".
  • A failed snapshot, reply or mark as read logs PostgREST's error code next to the HTTP status (snapshot failed: HTTP 404 (42P01)), never its message; the README's Troubleshooting table says what each code means. The device's calls send Content-Profile: public, so they work when public is not the first schema the Data API exposes.
  • Security: any app with notification access could rewrite the extras of the Reply action's intent, which must be mutable, and make this app post a notification with any title and body under its name and icon, or send the reply to another conversation. The intent's extras are now sealed with an HMAC keyed by a per-install secret, and a reply whose extras were changed is ignored. Anyone using the Reply action on 0.0.1 is affected and should update.
  • The example app registers and starts again on launch when the status is unregistered or rejected, as the README asks, marks a tapped notification read, and has a "Send test notification" button.
  • realtime_push_mark_all_read() reads every unread inbox row of the signed-in user in one call, for a "Mark all as read" button; one signal clears every device. Run the script again to get it.
  • realtime_push_send_test(p_title, p_body) lets a signed-in user send themselves a test notification, under the key realtime_push:test; a new one replaces the last, and one within 10 s of the last does nothing and returns null. Run the script again to get it.
  • README: a pg_cron job that deletes devices unseen for 90 days, which nothing else cleans up for users who never register again.
  • Security: a user keeps at most 10 devices. realtime_push_register deletes the caller's device seen least recently beyond that, and signals it, so a script can no longer register thousands of pairs that every notification to that user fans out to. Run the script again to get it.
  • Security: a device ends with the session it was registered in. realtime_push_register stores the JWT's session_id, and when Supabase Auth deletes that session (a sign-out with scope global or others, a password change, a revoked session) the device is deleted and signalled, so a lost phone stops even if its app never runs again. A session that already ended cannot register a device. Devices registered before have no session and are left alone. Run the script again to get it.
  • Security: a largeIcon whose host is a private, loopback or link-local IP address is ignored, like a non-https one, so a snapshot cannot make the phone send requests inside the network it is on. The README now says to build largeIcon only from storage you control, never from a URL a user typed, which lets its owner see when and from where each recipient got the notification.
  • Security: start refuses a secret key (sb_secret_…) or a service_role JWT as publishableKey, with an ArgumentError (bad_arguments on the Android side). Such a key bypasses RLS, and it was shipped in the APK, backed up with the app's settings and sent in the WebSocket URL.
  • Security: start takes an http:// URL only for local development (localhost, 127.0.0.1, ::1, 10.0.2.2). Over cleartext anyone on the network read the device secret, every notification and the topic. Use https://, or the new, insecure allowCleartext: true. A self-hosted server on the LAN reached over http now fails until one of the two.
  • Without the battery exemption, when Android refuses the foreground (the periodic check or a restart after the app was killed), the service now stays started until its snapshot read ends. It stopped at once, and Android 14+ could freeze the read halfway until the next check, minutes later.
  • A snapshot's optional more is the number of notifications it left out: the device shows one quiet "+15 more" (translated like Reply) that opens the app, and removes it at 0. The default inbox sets it to the unread keys past the 20 it lists. Run the script again to get it, after drop function public.realtime_push_snapshot_for(uuid); if you never replaced the default: the script keeps an existing one, as for "time".
  • A channel in start(channels: ...) can be quieter than the default: PushChannel('Offers', importance: PushImportance.low) shows without a sound, PushImportance.medium rings without popping up. A plain name still works and stays high. Android keeps a channel's importance once created, so changing it later needs a new channel id.

0.0.1 - 2026-11-28 #

  • Project scaffold and the Dart ↔ Android ↔ database contract.
  • CI scans every PR for leaked secrets (gitleaks) and grades the repository with OpenSSF Scorecard.
  • Dart API: device, start, stop, status, battery exemption, notification permission, launchTap and the taps stream.
  • README from setup to the first notification, and an example app that signs in, registers the device and starts the service.
  • supabase/realtime_push.sql: device registration, the snapshot, the "changed" signal and a ready-made inbox, tested on Postgres 17.
  • Android service that keeps the Realtime connection and shows the snapshot as notifications.
  • openConnectedNotificationSettings() opens the settings of the "connected" notification alone, so the user can hide it while the service keeps running.
  • Needs Flutter 3.44 or later: the Android build relies on Flutter applying the Kotlin plugin to apps without AGP 9's built-in Kotlin.
  • Reply from the notification: a snapshot entry with "reply": true gets a Reply action, the text goes to the new realtime_push_reply, which hands it to your realtime_push_reply_for, and a reply that fails says "Not sent" on the notification and keeps the text.
  • Notification channels and pictures: start(channels: {...}) declares more channels, a snapshot entry picks one with "channel", and "largeIcon" shows an https picture, such as the sender's avatar, beside the text.
  • start(foregroundService: false) never shows the "connected" notification: without the battery exemption the connection is held while the app is open, and with it closed a periodic check reads the snapshot. That check now also runs after Android kills the service, so notifications keep arriving, late, until the app opens again. The README and the example ask for the exemption when notifications are turned on.
2
likes
160
points
67
downloads
screenshot

Documentation

API reference

Publisher

verified publisherdevfrs.com

Weekly Downloads

Push notifications on Android without Firebase: a native service holds one Supabase Realtime connection and shows the notifications your database lists.

Repository (GitHub)
View/report issues
Contributing

Topics

#supabase #push-notifications #notifications #realtime #android

License

MIT (license)

Dependencies

flutter

More

Packages that depend on supabase_realtime_push

Packages that implement supabase_realtime_push