Apps
Android app
The Postern app for Android, building it from source, what push notifications need (Firebase Cloud Messaging), UnifiedPush, and Android's rules for unencrypted Hubs.
Postern for Android is the same app as the iOS app, built from the same source. This page covers what is different on Android: how to build it, what push notifications need, and Android's rules for Hubs without HTTPS. Connecting, App Lock, swipe actions and offline use work as described on the iOS page.
Status #
There is no Android release yet: build the app from source. The in-app mail engine is set up
for Android (build-engine.sh android), but it has not been tested end to end on Android yet,
and neither has push. If the engine is missing or doesn't start, the app loads mail through
your Hub and says so under Settings → About.
Build the app #
What you need #
- Git, Node.js 24 or newer with pnpm 11 (
corepack enable), and Go 1.27 or newer. - Android Studio, or the Android command line tools, with the Android SDK (platform
android-24or newer) and the NDK (r26 or newer). - JDK 17.
- gomobile, which builds the mail engine as an Android library.
Build and run #
Set ANDROID_HOME to the SDK and ANDROID_NDK_HOME to the NDK. The paths below are Android
Studio's defaults on macOS; on Linux the SDK is usually in ~/Android/Sdk.
export ANDROID_HOME="$HOME/Library/Android/sdk"
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/<version>"
git clone https://github.com/TheOriUHD/postern.git
cd postern
corepack enable
pnpm install
go install golang.org/x/mobile/cmd/gomobile@latest golang.org/x/mobile/cmd/gobind@latest
export PATH="$(go env GOPATH)/bin:$PATH"
gomobile init
apps/mobile/scripts/build-engine.sh android
pnpm --filter @postern/mobile android| Command | What it does |
|---|---|
apps/mobile/scripts/build-engine.sh android |
Builds the mail engine with gomobile into apps/mobile/modules/mail-engine/android/libs/engine.aar. ANDROID_API sets the minimum API level (default 24). all builds iOS and Android. |
pnpm --filter @postern/mobile android |
Runs expo run:android: generates the Android project in apps/mobile/android/, builds a debug build and installs it on the running emulator or connected phone. |
Check: the app opens with Scan QR code, Enter Hub address and Try the demo.
If it did not work: "Android build needs ANDROID_HOME and ANDROID_NDK_HOME" means one of
the two variables is not set. "gomobile not found" means gomobile is not on your PATH.
A debug build loads its code from the development server on your computer
(pnpm --filter @postern/mobile start) and allows plain HTTP to any address. For a build that
runs on its own, build the release variant:
cd apps/mobile
npx expo run:android --variant releaseExpo's generated project signs it with a debug key unless you set up your own signing key in
apps/mobile/android/app/build.gradle. That is enough to install it on your own phone.
Push notifications: what a build needs (FCM) #
Android notifications go through Firebase Cloud Messaging (FCM). The repository ships no Firebase configuration. A build made straight from it gets no push token, so turning on notifications in the app fails with an error. To build the app with push:
-
In the Firebase console, create a project, or use the one your relay uses (it must be the same project). Add an Android app with the package name
app.postern(expo.android.packageinapps/mobile/app.json; use yours if you changed it). -
Download
google-services.jsonfor that app and put it atapps/mobile/google-services.json. It identifies your Firebase project. Leave it out of a public fork if you want to keep the project ID private. -
In
apps/mobile/app.json, add"googleServicesFile": "./google-services.json"underexpo.android. -
Regenerate the project and build:
cd apps/mobile npx expo prebuild --platform android --clean npx expo run:android --variant release -
Give your push relay a service-account key of the same Firebase project (
FCM_CREDENTIALS_FILE, see Run your own relay), and point your Hub at the relay withPOSTERN_RELAY_URL. -
Test it end to end: sign in on the phone, turn on Settings → Notifications → This device → Notifications, send yourself a message, and check that the notification arrives while the app is in the background and after you swiped it away.
Check: the notification arrives within a few seconds, and Settings → Devices in the web app shows "notifications on" for the phone.
If it did not work: "Your Hub isn't set up to send notifications yet" means the Hub has
no POSTERN_RELAY_URL. If the relay reports errors for the phone, its Firebase project
differs from the one in google-services.json.
Notifications use the channel New mail (high importance, private on the lock screen).
Note
Android notifications have no Archive and Mark as Read buttons. The relay sends a notification message that Android shows by itself while the app is in the background, and such notifications can't carry the app's buttons.
Note
Expo Go on Android can't receive notifications. Use a build made with expo run:android.
Without Google services (UnifiedPush) #
The Hub can push straight to a UnifiedPush endpoint, for example an ntfy server, without the relay and without Google. The Android app does not register such an endpoint yet: that needs a native UnifiedPush module, which the app doesn't have. Until then, a phone without Google services gets no notifications while the app is closed. It catches up when you open the app.
Unencrypted (HTTP) Hubs #
Two rules apply, the app's and Android's.
The app connects over plain HTTP without asking only when the Hub is on the phone or the
local network: localhost, private addresses (10.x, 172.16 to 31.x, 192.168.x, 100.64 to
127.x), names ending in .local, .lan, .home.arpa or .internal, and single-word names.
Any other HTTP address shows This Hub isn't encrypted first, and a pairing code always
shows which Hub it connects to before anything is sent.
Android (release builds) allows plain HTTP only to the names and addresses in the app's
network security config, which apps/mobile/plugins/withLocalCleartextOnly.js writes:
| Allowed over HTTP | |
|---|---|
| Names | localhost, and anything ending in .local, .lan, .home.arpa or .internal |
| Addresses | 127.0.0.1, and the emulator's host addresses 10.0.2.2 and 10.0.3.2 |
Android can't allow IP address ranges, so a Hub reached over HTTP by a LAN IP address, such as
http://192.168.1.20:8080, or by a single-word name, is blocked in release builds. Give the
Hub HTTPS (see HTTPS), or reach it by a name such as hub.lan or
hub.local. Debug builds allow plain HTTP everywhere.
App Lock #
Settings → This phone → App Lock asks for your fingerprint, face or the screen lock (PIN, pattern or password) when you open Postern. It behaves as on iOS: see App Lock.
Lost your phone #
Sign it out from Settings → Devices on another device. See Lost or stolen device.