This release is a pre-release and may not be stable for production use.
pyxpo-notifications
Local notifications for pyxpo apps. The API follows
expo-notifications. iOS uses UserNotifications.
Android posts with NotificationManager and schedules with AlarmManager (no Firebase); scheduled notifications
are set again after a reboot or an app update.
pip install pyxpo-notifications
[tool.pyxpo]
modules = ["notifications"]
# Optional: exact timing on Android 12+. Without it Android may show a scheduled notification a little late.
[tool.pyxpo.android]
permissions = ["android.permission.SCHEDULE_EXACT_ALARM"]
import pyxpo_notifications as Notifications
# Show notifications while the app is open too (without a handler they show only in the background).
Notifications.set_notification_handler({
"handle_notification": lambda n: {"should_show_banner": True, "should_show_list": True,
"should_play_sound": True, "should_set_badge": False},
})
perm = await Notifications.request_permissions_async()
if perm["granted"]:
await Notifications.schedule_notification_async({
"content": {"title": "Tea", "body": "Your tea is ready", "data": {"cup": 2}},
"trigger": {"type": Notifications.SchedulableTriggerInputTypes.TIME_INTERVAL, "seconds": 180},
})
sub = Notifications.add_notification_response_received_listener(
lambda r: print("tapped", r["notification"]["request"]["content"]["data"]))
Functions
| Function | Notes |
|---|---|
request_permissions_async(ios=...) / get_permissions_async() |
Expo's permission response, plus ios (status as IosAuthorizationStatus, allowsAlert, allowsBadge, allowsSound, ...) or android (importance, interruptionFilter). iOS options: allow_alert, allow_badge, allow_sound, allow_provisional, allow_critical_alerts, provide_app_notification_settings. A provisional iOS permission has granted False and ios.status == PROVISIONAL. |
use_permissions(get=True, request=False) |
Hook: (response, request, get). |
schedule_notification_async({"content", "trigger", "identifier"}) |
Returns the identifier. trigger None (or only channel_id) shows it now. |
get_all_scheduled_notifications_async() |
[{"identifier", "content", "trigger"}]. |
cancel_scheduled_notification_async(id) / cancel_all_scheduled_notifications_async() |
|
get_next_trigger_date_async(trigger) |
Milliseconds since 1970, or None. |
get_presented_notifications_async() |
Shown notifications: [{"date", "request"}]. |
dismiss_notification_async(id) / dismiss_all_notifications_async() |
|
set_notification_handler(handler) |
handle_notification(notification) (may be async) returns should_show_banner, should_show_list, should_play_sound, should_set_badge; optional handle_success(id), handle_error(id, error). It has 3 seconds to answer. |
add_notification_received_listener(fn) |
A notification arrived while the app is open. |
add_notification_response_received_listener(fn) |
The user tapped one: {"notification", "actionIdentifier"} (DEFAULT_ACTION_IDENTIFIER). |
get_last_notification_response_async() / use_last_notification_response() |
The last tap, including the one that launched the app. clear_last_notification_response_async() forgets it. |
get_badge_count_async() / set_badge_count_async(n) |
iOS app icon badge. Android: 0 and False (launchers count notifications). |
set_notification_channel_async(id, channel), get_notification_channel_async(id), get_notification_channels_async(), delete_notification_channel_async(id) |
Android channels: name, importance (AndroidImportance), description, vibration_pattern, enable_vibrate, enable_lights, light_color, lockscreen_visibility, show_badge, bypass_dnd, sound ('default' or None). None or [] on iOS. |
Notification content: title, subtitle, body, data (a JSON-compatible dict), badge, sound (True for
the default sound); Android also sticky, auto_dismiss, priority, color; iOS interruption_level.
Android shows a notification on trigger["channel_id"], else on a default channel.
Triggers (SchedulableTriggerInputTypes):
| Type | Keys |
|---|---|
TIME_INTERVAL |
seconds, repeats (iOS repeats only every 60 seconds or more) |
DATE |
date: a datetime or milliseconds. A bare datetime or number works as a trigger too. |
DAILY |
hour, minute |
WEEKLY |
weekday (1 is Sunday), hour, minute |
MONTHLY |
day, hour, minute (months without that day are skipped) |
YEARLY |
month (0 is January), day, hour, minute |
CALENDAR |
iOS only: year, month (1 is January), day, weekday, hour, minute, second, ..., repeats, timezone |
Times are local. camelCase names work too (scheduleNotificationAsync, {"channelId": "alerts"}).
Not supported yet
- Remote push:
get_device_push_token_async,get_expo_push_token_asyncandadd_push_token_listenerraiseNotSupportedError(they need Firebase on Android and an APNs AppDelegate hook on iOS). A remote notification that arrives on iOS still reaches the listeners. - Categories and action buttons, attachments, custom sounds.
Notes
- iOS: the Simulator cannot pre-grant notifications;
allow_provisionalgives quiet notifications without a prompt. - Android 13+: the system prompt needs
POST_NOTIFICATIONS(added by this package). Without the permission the system drops notifications silently. - Android: a notification fired while the app is open goes to Python first; with no handler it is not shown.
Metadata
Release files for pyxpo-notifications 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyxpo_notifications-0.1.0a1.tar.gz | 27.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyxpo_notifications-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.6 kB
Release files / pyxpo_notifications-0.1.0a1.tar.gz
| Download URL | pyxpo_notifications-0.1.0a1.tar.gz |
|---|---|
| Size | 27.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69131dfc8331653a26210d641fc502d41b4417ef99dea913ac15544304a47928
|
|
BLAKE2b-256 checksum How to use checksums |
b3ed20f3dac95d7e36665b0ac0e61909253a075fad5bec93ade5e586438b91e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / pyxpo_notifications-0.1.0a1-py3-none-any.whl
| Download URL | pyxpo_notifications-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 28.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1aaf9e82f3938f32ba37d00906a5a2950c9feaef1018a06e5f3cfa0a34d8711
|
|
BLAKE2b-256 checksum How to use checksums |
b33981e7918e65e3583033801736c3684240ac5a3d62fcb7ff805b5bf6860176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log