Receive Android notifications over a separate BLE companion and subscribe directly to ANCS for iPhone notifications. Both require phone system permission and board display integration.
Select the instance and event type
| Feature | Integration point | Data |
|---|---|---|
| Android notifications | Core BLE companion with bluetooth_auxiliary=true and notifications=true |
moto_event notification callback |
| iPhone notifications | Board ANCS client and separate moto_ancs parser |
moto_ancs_notification callback |
Setting notifications=true on the managed Wi-Fi instance does not create a Bluetooth connection. The current APP sends Android notifications through an independent BLE instance. Share device credentials and owner records as described in Wi-Fi and Bluetooth. See main/terminal.c, main/ancs_adapter.c and main/notice_view.c in the full reference application. Core moto_event is not a managed event: it has no e.data.notification, and the handles are not interchangeable.
Android notifications
- Enable notifications on the BLE companion and connect GATT transport and authentication.
- The user enables sharing in the APP and completes system companion association and notification-access permission.
- Display the application, title and body on
MOTO_EVENT_NOTIFICATION; remove the matching notification ID onMOTO_EVENT_NOTIFICATION_REMOVE. - Clear content and buttons on disconnect or expiry. UI queuing must not restart the validity period.
Call moto_event_get_notification(event, ¬ice) inside the core event callback to obtain an owned moto_notification without parsing CBOR yourself:
#include <moto/sdk.h>
moto_result example_core_notice(const moto_event *event, moto_notification *out) {
return moto_event_get_notification(event, out);
}
On MOTO_OK, the snapshot contains id, ttl_ms, actions, app, title and text. Strings are copied with the structure, so it can be queued to the UI. REMOVE copies only id and clears other fields. This helper is safe inside callbacks; call it before event->body expires. Separately retain the original instance’s connection/session identity and receipt time. Discard button actions after expiry or a session change. This helper requires a new SDK package containing the symbol; upgrade headers and the static library together.
Show only permitted actions: actions & (1u << action). On the original BLE instance’s owner thread, outside callbacks, call moto_notification_action(sdk, notification_id, action): 0 positive, 1 negative. MOTO_EVENT_ACTION_RESULT reports submission, not that a call has connected.
Use e.data.notification and moto_terminal_notification_action(t, &saved_event, action) only if your managed transport already carries notifications. Save the complete original event. Retry only unqueued submissions after MOTO_FULL. This API does not turn a Wi-Fi instance into a BLE companion.
iPhone notifications
ANCS is Apple’s Bluetooth notification service. The iPhone system sends notifications directly to the terminal. Board drivers implement encrypted pairing, service discovery, user authorization and subscriptions. Subscribe to Data Source before Notification Source.
Use moto_ancs_* from moto/ancs.h to parse data. After link encryption and authorization, call moto_ancs_start and retain its returned epoch for subsequent inputs and actions. On disconnect, call moto_ancs_stop and discard callbacks from the old epoch. Serialize calls on one integration task.
The moto_ancs_config.notification callback provides a moto_ancs_notification; copy it for the UI before returning. removed clears the matching UID. Show permitted ANCS actions and submit them through moto_ancs_action. Successful ATT submission does not establish a changed call state.
Set ancs=true on the companion core and provide bool ancs_ready(void *user) to report actual subscriptions on the current encrypted link. MOTO_EVENT_ANCS_SHARING expresses sharing intent, not system authorization.
