Flet Local Notifications
A comprehensive Flet extension that demonstrates how to manage and send notifications across multiple platforms. This project provides a simple yet powerful interface for requesting notification permissions and sending them using native APIs, with cross-platform support for Android, Windows, and Linux devices.
🙏 Credits
Special thanks to @ITAkademi for the inspiration and guidance.
🌐 Platform Support
| Platform | Status | Notes |
|---|---|---|
| Android | ✅ Fully Supported | Native API integration |
| iOS | ⏳ Planned | Cannot test currently |
| Windows | ✅ Fully Supported | Desktop notifications |
| macOS | ✅ Fully Supported | Desktop notifications |
| Linux | ✅ Fully Supported | Desktop notifications |
✨ Features
- 🔐 Permission Management: Check and request notification permissions seamlessly
- 📱 Notification Sending: Send custom notifications with title and text
- 🤖 Android Integration: Uses native Android NotificationManager via JNI
- 🖥️ Desktop Support: Cross-platform desktop notifications
- ⏰ Scheduled Notifications: Plan notifications for future delivery
- 🎨 User-Friendly Interface: Simple and intuitive GUI built with Flet framework
- 🔧 Advanced Configuration: Extensive customization options
📋 Requirements
- Python 3.9+ - Modern Python features support
- Flet framework - Cross-platform UI framework
- Android device or emulator - For mobile testing
- Required permissions - Configured in
pyproject.tomlor inAndroidManifest.xml
🚀 Installation
pip CLI
pip install flet-local-notifications
uv CLI
uv add flet-local-notifications
💻 Usage
from flet_local_notifications import (
AndroidNotificationConfig,
DesktopNotificationConfig,
FletLocalNotification,
)
from flet import *
def main(page:Page):
noti = FletLocalNotification(page, lambda e: page.open(SnackBar(Text("Permission Acepted"))))
async def send(e):
await noti.send(
AndroidNotificationConfig(
title="Hello World",
message="Hello"
),
DesktopNotificationConfig(
title="Hello World",
message="Hello",
app_name="Flet-Test",
)
)
page.add(
Button(
text="Send",
on_click=lambda e: page.run_task(send, e) # <- use page.run_task() for run async functions if your main entry point is not async
)
)
app(target=main)
⚙️ Configuration
Pyproject.toml Setup
[tool.flet]
# Permissions For The App
permissions = [
"notification",
"access_notification_policy",
"post_notifications",
"wake_lock",
"foreground_service"
]
[tool.flet.android.permissions]
"android.permission.ACCESS_NOTIFICATION" = true
"android.permission.POST_NOTIFICATIONS" = true
"android.permission.WAKE_LOCK" = true
"android.permission.FOREGROUND_SERVICE" = true
"android.permission.INTERNET" = true
"android.permission.RECEIVE_BOOT_COMPLETED" = true
⚠️ Important Notice
For Android SDK > 35, you must manually add permissions to AndroidManifest.xml in your build project or use the custom build template.
Example 1: Manual Permission Addition
Add this line to your AndroidManifest.xml:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Example 2: Custom Build Template
Toml Configuration:
[tool.flet.template]
url = "gh:MasterA5/flet-build-template"
ref = "0.28.3"
Terminal Command:
flet build apk --template "gh:MasterA5/flet-build-template" --template-ref "0.28.3"
Example 3: Automatically patch AndroidManifest.xml after build (recommended)
If you are using Android SDK > 35 and prefer not to manually edit the manifest or rely on a custom build template, you can use the provided helper script.
💻 Terminal
flet build apk
python scripts/fix_manifest.py
🎯 Application Interface
The application provides comprehensive functionality:
- 🔍 Check Notification Permission: Verifies if the app has notification permissions
- 📋 Request Notification Permission: Requests notification permissions from the user
- 📤 Send Notification: Sends test notifications (enabled when permissions are granted)
- ⏰ Schedule Notifications: Plan notifications for specific times
- 🎨 Customize Notifications: Advanced styling and configuration options
🔧 Key Components
FletLocalNotification Class
The main class that handles cross-platform notification functionality:
- Platform Detection: Automatically detects Android vs Desktop environments
- Permission Handling: Manages notification permissions across platforms
- Unified API: Single interface for multiple platforms
- Async Support: Full asynchronous implementation
AndroidNotification Class
Located in flet_local_notifications/android/AndroidNotification.py:
- Native Integration: Uses Android NotificationManager via JNI
- Channel Management: Creates and manages notification channels
- Advanced Features: Progress bars, buttons, images, and more
- Permission Requests: Handles Android runtime permissions
DesktopNotification Class
Located in flet_local_notifications/desktop/DesktopNotification.py:
- Cross-Platform: Windows, macOS, and Linux support
- Native Notifications: Uses system notification services
- Interactive Elements: Buttons, reply fields, and callbacks
- Custom Styling: Icons, sounds, and attachments
📦 Dependencies
Core Dependencies
flet==0.28.3: Main UI frameworkdesktop-notifier: Desktop notification managementandroid-notify==1.60.8.dev0: Android notification support
🔐 Android Permissions
The app requests the following permissions (configured in pyproject.toml):
| Permission | Purpose |
|---|---|
notification |
Basic notification access |
access_notification_policy |
Access to notification policies |
post_notifications |
Ability to post notifications |
wake_lock |
Keep device awake for notifications |
foreground_service |
Run as foreground service |
INTERNET |
Network access (if needed, be deafult in a flet build template) |
RECEIVE_BOOT_COMPLETED |
Auto-start on boot |
🚀 Quick Start Examples
📱 | 💻 Basic Notification
import flet as ft
from flet_local_notifications import FletLocalNotification, AndroidNotificationConfig, DesktopNotificationConfig
async def main(page: ft.Page):
notifier = FletLocalNotification(page)
android_config = AndroidNotificationConfig(
title="Hello World!",
message="This is a test notification"
)
desktop_config = DesktopNotificationConfig(
title="Hello World!",
message="This is a test notification"
)
await notifier.send(android_config, desktop_config)
ft.app(target=main)
📱 | 💻 -> ⏰ Scheduled Notification
from datetime import datetime, timedelta
from flet_local_notifications import (
FletLocalNotifications,
AndroidNotificationConfig,
DesktopNotificationConfig,
AndroidScheduleNotificationConfig,
DesktopScheduleNotificationConfig,
)
import flet as ft
def main(page: ft.Page):
notifier = FletLocalNotification(page)
# ... notification configs ...
android_schedule_config = AndroidScheduleNotificationConfig(
android_config=AndroidNotificationConfig(
title="Schedule Notification",
message="Schedule Notification In Android Device",
),
notify_time=datetime.now() + timedelta(secconds=5)
)
desktop_schedule_config = DesktopScheduleNotificationConfig(
desktop_config=AndroidNotificationConfig(
title="Schedule Notification",
message="Schedule Notification In Android Device",
),
notify_time=datetime.now() + timedelta(secconds=5)
)
# Send Function
async def send_schedule(e):
await notifier.schedule(android_schedule_config, desktop_schedule_config)
page.add(ft.Button("Send Schedule", on_click=lambda e: page.run_task(send_schedule, e)))
ft.app(target=main)
🔮 Future Improvements
- iOS Support: Add iOS notification capabilities
- Notification Groups: Implement notification categories
- Advanced Actions: Enhanced notification interactions
- Rich Media: Audio, video, and interactive content
- Cloud Sync: Cross-device notification synchronization
- Analytics: Notification engagement tracking
📝 Notes
- Permission Requirements: Notification functionality requires proper permissions to be granted by the user
- Native APIs: The app uses native platform APIs for reliable notification delivery
- Platform Differences: Some features may vary between platforms due to OS limitations
- Testing: Always test on target platforms before deployment
🤝 Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Development Guidelines
- Follow PEP 8 style guidelines
- Add type hints for new functions
- Include docstrings for public APIs
- Add tests for new features
- Update documentation as needed
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
MasterA5 - Creator and Maintainer - GitHub Profile
🙏 Acknowledgments
- @ITAkademi - For the inspiration and guidance
- Flet - The amazing framework that makes this possible
- android_notify - Android notification support
- desktop-notifier - Desktop notification support
🆘 Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include your platform, Python version, and minimal reproduction code
- Provide screenshots or error messages when applicable
⭐ Star this repository to stay updated with new features and improvements!
📢 Share this project with other Flet developers who might find it useful!
Metadata
Release files for flet-local-notifications 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flet_local_notifications-1.2.2.tar.gz | 15.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flet_local_notifications-1.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / flet_local_notifications-1.2.2.tar.gz
| Download URL | flet_local_notifications-1.2.2.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e6b3d0542b7198d6b8ed907f0e673a058226c99ac12d15bd08512b26cfdaf0d
|
|
BLAKE2b-256 checksum How to use checksums |
fdcd24af1fe01a4773c31ef3221dd1d0b1f6c6926792e0e55c5ff94b04637492
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 11, 2026.
Transparency logRelease files / flet_local_notifications-1.2.2-py3-none-any.whl
| Download URL | flet_local_notifications-1.2.2-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d56765fa132e92b0710bbf7f692e12c8ef85631671bb203bdf7da7611b2b734a
|
|
BLAKE2b-256 checksum How to use checksums |
802f1a1bfbed9f94e1fc1327b6941bd4692f1318dd81287a2fd50fe94053f0c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 11, 2026.
Transparency log