User interface and operations
The Android user interface gives an operator one place to start or stop the SMS gateway, check local and cloud service status, inspect message activity, review logs, manage webhook settings, and change gateway behavior. The app uses one main activity with three tab areas, and each area is built from smaller Android fragments that own one focused view or settings group.
Main activity navigation
The main activity is the shell for the operator experience. It presents Home, Messages, and Settings as tabs, and it can open a selected tab when another part of the app starts it.
flowchart LR
A[Main activity] --> B[Home fragment]
A --> C[Messages holder fragment]
A --> D[Settings fragment]
C --> E[Outgoing messages]
C --> F[Incoming messages]
E --> G[Message details]
D --> H[Gateway and operation settings]
H --> I[Logs]
H --> J[Registered webhooks]
Home workspace
The Home workspace is the control point for service operation. It shows whether either the local server or cloud gateway is active, lets the operator enable each path, and provides a single start or stop action for the service group. It also exposes the addresses, credentials, and device identifiers needed to connect to an enabled server.
The workspace also controls start on boot. If cloud access is enabled without a device registration, the start action first asks the operator to sign up, sign in, or use a login code. Registration completes before the app checks permissions and starts the services, and the UI blocks another registration request while one is active. The app requests the phone and SMS permissions needed for gateway work; if some permissions are denied, it warns the operator that some features may not work.
References: app/…/HomeFragment.kt• L66-143 app/…/HomeFragment.kt• L168-194 app/…/HomeFragment.kt• L373-480 app/…/fragment_home.xml• L10-22 app/…/fragment_home.xml• L69-76 app/…/fragment_home.xml• L175-182 app/…/fragment_home.xml• L243-261
Tab navigation
The tab layout keeps the three main work areas separate while the message and settings areas open their own child screens. The Messages tab starts on outgoing activity. Its holder fragment switches to incoming activity without leaving the tab, and a selected outgoing message opens a detail view on the back stack.
References: app/…/MainActivity.kt• L15-49 app/…/MainActivity.kt• L59-75 app/…/HolderFragment.kt• L14-33 app/…/HolderFragment.kt• L44-103
Message monitoring
The Messages area gives the operator two views of gateway traffic. Outgoing messages show queue and delivery state, while incoming messages show received content by message type. Both views keep the newest data visible, let the operator filter the activity by a counted status or type, and load more history as the operator reaches the end of the list. The state meanings come from message processing and outbound message delivery; incoming records originate in inbound SMS/MMS capture.
Outgoing message view
The outgoing view combines queue totals with a list of message records. Its summary presents selectable counts for all, pending, sent, delivered, failed, and cancelled messages, while a zero-count status is hidden so the panel stays focused on useful filters. Each row shows the message identifier, creation time, and current state, with a state-specific color that helps the operator scan delivery status; selecting a row opens the message body and the state of each recipient.
References: app/…/MessagesListFragment.kt• L37-113 app/…/fragment_messages_list.xml• L10-100 app/…/strings.xml• L150-188 app/…/themes.xml• L34-41 app/…/Colors.kt• L5-13
Incoming message view
The incoming view presents received SMS, data SMS, and MMS records as a separate activity stream. Its summary provides counted filters for all, SMS, data SMS, and MMS, and hides types with no records. If the selected type becomes empty, the view returns to All so the operator does not remain on a blank filter. Each row gives the sender, message type, short content preview, and receive time.
References: app/…/IncomingMessagesListFragment.kt• L34-99 app/…/fragment_incoming_messages_list.xml• L10-82 app/…/strings.xml• L151-188 app/…/themes.xml• L34-41
Message detail view
The detail view explains one outgoing message after the operator selects it. It keeps the message identifier and overall state at the top, then shows the message content and a recipient list with each recipient state and any recorded error.
References: app/…/MessageDetailsFragment.kt• L14-20 app/…/MessageDetailsFragment.kt• L33-48 app/…/fragment_message_details.xml• L14-42 app/…/fragment_message_details.xml• L50-88 app/…/MessageRecipientsAdapter.kt• L11-36
Gateway configuration
The Settings tab turns operational choices into grouped preference screens. The groups cover server access, message processing, inbox capture, webhooks, encryption, health checks, logs, system behavior, language, and app information. Settings screens validate values where a bad value could prevent a service from working. The settings map to the gateway behavior described in configuration management.
Server settings
The local server settings define how clients reach the phone. They cover the listening port, local credentials, token lifetime, and device identity. The cloud server settings define the cloud address, private access token, notification channel, registered account details, and temporary sign-in code. Changes to either server path require a restart before the active service uses them.
References: app/…/root_preferences.xml• L3-30 app/…/local_server_preferences.xml• L4-50 app/…/cloud_server_preferences.xml• L4-59 app/…/LocalServerSettingsFragment.kt• L11-76 app/…/CloudServerSettingsFragment.kt• L22-59
Device identity settings
Device identity settings give the operator control over the encryption identity used by the gateway. The screen shows the active public-key fingerprint for checking the device identity, lets the operator copy that fingerprint, and supports manual or scheduled key rotation. A changed rotation interval starts the rotation service again so the new schedule can take effect. See device identity and key management for the key lifecycle and server relationship.
References: app/…/DeviceSettingsFragment.kt• L17-23 app/…/DeviceSettingsFragment.kt• L46-58 app/…/DeviceSettingsFragment.kt• L60-111 app/…/device_preferences.xml• L4-23 app/…/DeviceService.kt• L84-116 app/…/DeviceService.kt• L218-231
Message and inbox settings
The message settings control how queued sends are selected and paced. They also provide message limits and optional working hours. Inbox settings control whether the app watches the phone message store, how long incoming records remain available, and the maximum MMS attachment size that can be included in webhook or cloud payloads. Larger attachments remain on the device for access through the inbox attachment path.
References: app/…/messages_preferences.xml• L4-84 app/…/inbox_preferences.xml• L4-24 app/…/MessagesSettingsFragment.kt• L11-79 app/…/InboxSettingsFragment.kt• L9-51 app/…/ReceiverSettings.kt• L15-30
Webhook settings
Webhook settings control how gateway events reach registered external endpoints. The operator can require an internet connection, set the retry count, and set a signing key. A separate registered-webhook view lists each endpoint with its identifier, event, and source. Selecting an entry copies its identifier for use in follow-up operations. The Settings area also exposes the delivery queue so the operator can inspect webhook work that is pending, in progress, complete, or failed. The delivery rules are described in webhook delivery.
References: app/…/webhooks_preferences.xml• L4-29 app/…/WebhooksSettingsFragment.kt• L9-32 app/…/WebhooksListFragment.kt• L16-51 app/…/WebhookAdapter.kt• L16-41
Webhook delivery queue
The webhook delivery queue gives the operator a view of delivery work and its outcome. A status summary provides filters for all entries, pending work, active work, completed work, failed work, and permanently failed work. Filters with no entries are hidden, and an empty active filter returns to the full queue so the screen does not show a misleading blank result.
Each queue row shows the endpoint, current status, retry count, and creation time. Selecting a row opens its identifier, endpoint, status, retry details, last error, attempt times, and stored event payload. If cleanup has removed the entry or payload, the detail view reports that the requested data is unavailable instead of treating it as a successful delivery.
References: app/…/WebhookQueueListFragment.kt• L22-62 app/…/WebhookQueueListFragment.kt• L64-163 app/…/WebhookQueueAdapter.kt• L14-69 app/…/WebhookQueueDetailFragment.kt• L23-101 app/…/fragment_webhook_queue_list.xml• L11-134 app/…/fragment_webhook_queue_detail.xml• L15-160 app/…/item_webhook_queue.xml• L9-45
System and diagnostic settings
The remaining settings protect service continuity and help the operator inspect behavior. They include the encryption passphrase, ping interval, log retention, battery optimization handling, language, and app version. The log preference opens the latest log entries without mixing them into the message views.
See Operational logs and retention for log storage, retention, and troubleshooting use.
References: app/…/root_preferences.xml• L32-84 app/…/SettingsFragment.kt• L21-78 app/…/SettingsFragment.kt• L81-109
Operational feedback
The UI does not rely on one status screen for all service work. It combines live service state on Home with persistent message history, log history, and Android notifications so that an operator can see both current health and past outcomes. The wider service start and stop behavior is covered in application lifecycle.
Log access
The Settings tab provides a direct path to the log list. The list presents recent operational entries in reverse-current order, so a new entry moves to the top while the operator is viewing it.
See Operational logs and retention for the full log lifecycle.
References: app/…/root_preferences.xml• L49-59 app/…/LogsListFragment.kt• L17-54 app/…/fragment_logs.xml• L2-12
Notification access
Android notifications provide status outside the open activity. They keep long-running local-server, real-time gateway, ping, send, and webhook work visible. A notification can return the operator to the app, and an incoming-webhook notice opens the Settings tab for review.
See Notifications and foreground services for notification channels, foreground work, and push handling.
References: app/…/NotificationsService.kt• L20-43 app/…/NotificationsService.kt• L45-83 app/…/AndroidManifest.xml• L32-50
Change checklist
When these files or sections are changed, remember to consider these:
- When the top-level tabs change, keep the tab count, fragment mapping, tab index values, and intent-based tab selection aligned.
- When service state changes, keep Home’s combined local-or-cloud status and its start, stop, and restart messages consistent with the service lifecycle.
- When a preference key, default, or value rule changes, update the matching settings object and the summary or validation behavior for that preference.
- When the MMS inline attachment limit changes, keep the preference key, UI range, stored receiver setting, import/export validation, and payload behavior aligned.
- When device identity controls change, keep the preference keys, fingerprint display, copy action, rotation schedule, and device key service contract aligned.
- When message or recipient state fields change, update the queue summary, list filters, list rows, and detail view together so the operator sees one consistent state.
- When message state colors change, keep the visual mapping aligned with every message and recipient state shown in the UI.
- When an incoming message type changes, keep its count, filter chip, localized label, and list representation aligned.
- When webhook event or source data changes, keep the registered-webhook list and its labels aligned with the data sent by the webhook system.
- When webhook queue statuses or fields change, keep the status counts, visible filters, list rows, and detail fields aligned with the queue data.
- When a webhook queue entry or payload can be removed before detail view opens, keep the missing-entry and missing-payload states clear to the operator.
- When a notification gains a new destination, keep its notification identifier and destination tab or screen in sync.
- When the first-start, registration, or password prompt contract changes, keep its result values, validation rules, duplicate-request guard, and the Home start flow aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The operator enables or changes a server path while a service is running | The screen warns that a restart is needed, so the active service can continue with the old choice until restart | Home reports the restart need when a server switch changes during active service work |
| Cloud service is enabled without device registration | Start does not proceed directly; the first-start flow asks for sign-up, account credentials, or a login code | Complete one of the registration paths before starting cloud-backed work |
| Device registration fails | The service does not start from that registration attempt, and the UI reports the registration error | Resolve the registration problem and start again |
| A second cloud registration request is made while one is active | The extra request is ignored, which prevents competing registration results from changing the active device state | Wait for the current registration attempt to finish |
| A first-start or password prompt is canceled or submitted without a password | The requested registration or protected action does not receive usable credentials | Choose a registration path and enter a non-empty password before continuing |
| Required phone or SMS permission is denied | Some gateway features may not work even if the service starts | Grant the requested permissions and confirm the Android permission state |
| An invalid local port, credential, or token lifetime is entered | The settings screen rejects the value and the related server configuration does not change | Use the field rules shown by the local server settings screen |
| The cloud address is not a valid URL | Cloud configuration is rejected before it can be used | Enter a valid URL and save it again |
| An MMS inline attachment limit is not a whole number between 0 and 67108864 bytes | The inbox setting is rejected, so the previous limit remains active | Enter a value in the range shown by the inbox settings screen |
| A selected message filter has no records after totals change | The filter can show no useful results | The message views hide zero-count filters and reset an empty active filter to All |
| A selected webhook queue entry is removed or its payload is cleaned up before detail view reads it | The detail screen cannot show the requested record or event body | Treat the not-found and unavailable-payload messages as valid terminal UI states |
| The active device key is unavailable or its fingerprint cannot be decoded | The identity screen shows that no fingerprint is available, and the operator cannot copy a fingerprint | Restore or create a valid device key before using fingerprint checks |
| Device key rotation fails | The active identity is not changed through the failed action, and the screen reports the failure | Review the error and retry rotation when the device key service is available |
Key files
| File | Why to read it |
|---|---|
| app/…/MainActivity.kt | Defines the top-level tabs and the activity entry path. |
| app/…/HomeFragment.kt | Shows how the UI reports service state, handles registration, and starts or stops gateway work. |
| app/…/fragment_home.xml | Defines the operator view for local and cloud service controls and connection details. |
| app/…/PasswordPromptDialogFragment.kt | Defines the protected-action prompt and its result contract. |
| app/…/HolderFragment.kt | Connects the Messages tab to outgoing and incoming views. |
| app/…/MessagesListFragment.kt | Connects outgoing queue counts, filters, and message history to the operator view. |
| app/…/IncomingMessagesListFragment.kt | Connects incoming type counts, filters, and history to the operator view. |
| app/…/MessageDetailsFragment.kt | Defines the operator view for one outgoing message and its recipients. |
| app/…/Colors.kt | Defines the visual state mapping used for message and recipient status. |
| app/…/InboxSettingsFragment.kt | Validates the operator controls for inbox monitoring, retention, and MMS attachment inlining. |
| app/…/inbox_preferences.xml | Defines the inbox monitoring, retention, and MMS attachment settings exposed to the operator. |
| app/…/ReceiverSettings.kt | Defines the stored receiver limits that govern inbox capture and attachment handling. |
| app/…/SettingsFragment.kt | Loads the settings tree and handles system-level settings behavior. |
| app/…/root_preferences.xml | Maps the Settings tab to the main operational setting groups and log access. |
| app/…/local_server_preferences.xml | Defines the local server settings exposed to the operator. |
| app/…/cloud_server_preferences.xml | Defines the cloud gateway settings exposed to the operator. |
| app/…/DeviceSettingsFragment.kt | Connects device fingerprint display, copying, and key rotation controls to device identity behavior. |
| app/…/device_preferences.xml | Defines the device identity settings exposed to the operator. |
| app/…/webhooks_preferences.xml | Defines webhook policy settings and the registered-webhook entry point. |
| app/…/WebhooksListFragment.kt | Shows how registered webhook data is presented and how an empty list is handled. |
| app/…/WebhookQueueListFragment.kt | Shows how queue status counts, filters, empty states, and detail navigation reach the operator. |
| app/…/WebhookQueueDetailFragment.kt | Shows the operator view for one webhook delivery attempt and its payload. |
| app/…/WebhookQueueAdapter.kt | Defines the summary fields shown for each queue entry. |
| app/…/LogsListFragment.kt | Shows the UI entry point for recent operational logs. |
| app/…/NotificationsService.kt | Defines the user-facing notification types and their activity destinations. |