A Flet Extension that demonstrates how to manage and send notifications on Android Windows and Linux devices (for now) . This project provides a simple interface for requesting notification permissions and sending them using Android's native APIs, with the intention of adding more platforms to the project in the future.
| Platform | Status |
|---|---|
| Android | ✅ |
| iOS | ⏳ Can't test |
| Windows | ✅ |
| macOS | ⏳ Can't test |
| Linux | ✅ |
- Permission Management: Check and request notification permissions
- Notification Sending: Send custom notifications with title and text
- Android Integration: Uses native Android NotificationManager via JNI
- User-Friendly Interface: Simple GUI built with Flet framework
- Python 3.9 or higher
- Flet framework
- Android device or emulator for testing
- Required permissions configured in
pyproject.toml - Support for android 16 (API 36)
git clone <repository-url>
cd FletNotificationflet runflet build apk[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" = trueFor Android SDK > 35, you must manually add the permission to AndroidManifest.xml in your build project or you can use my custom build template
Add Permission Manually in AndroidManifest.xml
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />Use My Custom Template For Build
[tool.flet.template]
path = "gh:MasterA5/flet-build-template" # --template
ref = "0.28.3" # --template-refflet build apk --template "gh:MasterA5/flet-build-template" --template-ref "0.28.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.
flet build apk
python scripts/fix_manifest.pyThe app provides the following functionality:
- Check Notification Permission: Verifies if the app has notification permissions
- Request Notification Permission: Requests notification permissions from the user
- Send Notification: Sends a test notification (only enabled when permissions are granted)
FletNotification/
├── scripts/
│ └── fix_manifest.py # Script to fix AndroidManifest.xml
├── src/
│ ├── main.py # Main application entry point
│ └── flet_post_notification.py # Notification handling class
├── pyproject.toml # Project configuration and dependencies
└── README.md # This file
└── .gitignore # Git ignore file
Located in src/flet_post_notification.py, this class handles the native Android notification functionality:
- Creates notification channels
- Builds and displays notifications
- Uses JNI (Java Native Interface) via pyjnius to access Android APIs
Located in src/main.py, this provides:
- Permission checking and requesting
- User interface with buttons and status indicators
- Integration with Flet's permission handler
flet==0.28.3: Main UI frameworkpyjnius: Python-Java bridge for Android integrationflet-permission-handler: Flet plugin for handling permissionsdesktop-notifier: Pacakge to send desktop notifications
The app requests the following permissions (configured in pyproject.toml):
notification: Basic notification accessaccess_notification_policy: Access to notification policiespost_notifications: Ability to post notificationswake_lock: Keep device awake for notificationsforeground_service: Run as foreground service
- Add support for scheduled notifications
- Implement notification groups and categories
- Add support for notification actions and buttons
- Improve notification styling and customization
- ✅ Add support for more platform-specific features (iOS, Windows, etc.)
- Notification functionality requires proper permissions to be granted by the user
- The app uses native Android APIs for reliable notification delivery
This project is open for contributions. Feel free to submit issues or pull requests.