A Python package that simplifies creating Android notifications in Kivy and Flet apps.
Project description
Android-Notify
Android Notify is a Python library for effortlessly creating and managing Android notifications in Kivy and Flet apps.
Supports various styles and ensures seamless integration, customization and Pythonic APIs.
Features
-
Multiple Notification Styles: Support for various notification styles including:
- Simple text notifications
- Progress bar notifications (determinate and indeterminate)
- Large icon notifications
- Big picture notifications
- Combined image styles
- Custom notification Icon - images section
- Big text notifications
- Inbox-style notifications
- Colored texts and Icons
-
Rich Functionality:
- Add action buttons with custom callbacks
- Update notification content dynamically
- Manage progress bars with fine-grained control
- Custom notification channels for Android 8.0+ (Creating and Deleting)
- Silent notifications
- Persistent notifications
- Click handlers and callbacks
- Cancel Notifications
- Use Custom Sound
- Vibration section
Quick Start
from android_notify import Notification
# Simple notification
Notification(
title="Hello",
message="This is a basic notification."
).send()
Sample Image:
Installation
Kivy apps:
In your buildozer.spec file, ensure you include the following:
# Add pyjnius so ensure it's packaged with the build
requirements = python3, kivy, pyjnius, android-notify
# Add permission for notifications
android.permissions = POST_NOTIFICATIONS
# Required dependency (write exactly as shown, no quotation marks)
android.gradle_dependencies = androidx.core:core-ktx:1.15.0
android.enable_androidx = True
android.api = 35
Desktop
For IDE IntelliSense Can be installed via pip install:
pip install android_notify
android-notify -v
Installing without Androidx
How to use without gradle_dependencies
Use android-notify==1.61.3.dev0 to install via pip
Flet apps:
In your pyproject.toml file, ensure you include the following:
[tool.flet.android]
dependencies = [
"pyjnius","android-notify==1.61.3.dev0"
]
[tool.flet.android.permission]
"android.permission.POST_NOTIFICATIONS" = true
- example of complete flet pyproject.toml
In Kivy
# buildozer.spec
requirements = python3, kivy, pyjnius, android-notify==1.61.3.dev0
On Pydroid 3
On the pydroid 3 mobile app for running python code you can test some features.
- In pip section where you're asked to insert
Libary namepasteandroid-notify==1.61.3.dev0 - Minimal working example
# Testing with `android-notify==1.61.3.dev0` on pydroid
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from android_notify import Notification
from android_notify.core import asks_permission_if_needed
class AndroidNotifyDemoApp(App):
def build(self):
layout = BoxLayout(orientation='vertical', spacing=10, padding=20)
layout.add_widget(Button(
text="Ask Notification Permission",
on_release=self.request_permission
))
layout.add_widget(Button(
text="Send Notification",
on_release=self.send_notification
))
return layout
def request_permission(self, *args):
asks_permission_if_needed(legacy=True)
def send_notification(self, *args):
Notification(
title="Hello from Android Notify",
message="This is a basic notification."
).send()
if __name__ == "__main__":
AndroidNotifyDemoApp().run()
Documentation
For Dev Version usage
requirements = python3, kivy, pyjnius, https://github.com/Fector101/android_notify/archive/main.zip
Add Data to Notification
NotificationHandler.data_objectreturns adictof data in the clickednotificationsetDatacan also be called aftersendto changedata_objectstored- Use
nameif value is constantNotification(name="change page")
from android_notify import Notification, NotificationHandler
def build(self):
notification = Notification(title="Hello")
notification.setData({"next wallpaper path": "test.jpg"})
notification.send()
def on_start(self):
notification_data = NotificationHandler.data_object # {"next wallpaper path": "test.jpg",...}
print(notifcation_data)
def on_resume(self):
notification_data = NotificationHandler.data_object # {"next wallpaper path": "test.jpg",...}
print(notifcation_data)
For full documentation, examples, and advanced usage, API reference visit the documentation
☕ Support the Project
If you find this project helpful, your support would help me continue working on open-source projects donate
Bug Reports & Feature Requests
Found a bug or have an idea for a new feature?
Feel free to open an issue here
When reporting a bug, try to include:
- Device name
- Android version
- Steps to reproduce the issue
- Screenshots or logs (if possible)
Feature suggestions are also welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file android_notify-1.61.3.tar.gz.
File metadata
- Download URL: android_notify-1.61.3.tar.gz
- Upload date:
- Size: 90.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b068002c5236faba403308b98ba1b2da324bfdbf5cb8eccc0efd0ad6d3ddf89c
|
|
| MD5 |
9a290e9dd79a9ef27cf0c8d2a9eb33e8
|
|
| BLAKE2b-256 |
eb7d428b23ba9e5360da503636a0bdebe7a47f951e028e0a3502ce0a31595141
|
Provenance
The following attestation bundles were made for android_notify-1.61.3.tar.gz:
Publisher:
publish.yml on Fector101/android_notify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
android_notify-1.61.3.tar.gz -
Subject digest:
b068002c5236faba403308b98ba1b2da324bfdbf5cb8eccc0efd0ad6d3ddf89c - Sigstore transparency entry: 1643035707
- Sigstore integration time:
-
Permalink:
Fector101/android_notify@032a454d86d8e2c117011da46ac63670c4c8b20d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Fector101
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@032a454d86d8e2c117011da46ac63670c4c8b20d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file android_notify-1.61.3-py3-none-any.whl.
File metadata
- Download URL: android_notify-1.61.3-py3-none-any.whl
- Upload date:
- Size: 100.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dd69de40c424582dabc389559294e20801b4de71bc349bf4db8a9ea66c98521
|
|
| MD5 |
0df67a64645d0070b8c88db0c735fbba
|
|
| BLAKE2b-256 |
5b65eb93e1d6b6793400251b159834b311f45275bf8e4b16a17800117126ed0d
|
Provenance
The following attestation bundles were made for android_notify-1.61.3-py3-none-any.whl:
Publisher:
publish.yml on Fector101/android_notify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
android_notify-1.61.3-py3-none-any.whl -
Subject digest:
2dd69de40c424582dabc389559294e20801b4de71bc349bf4db8a9ea66c98521 - Sigstore transparency entry: 1643035765
- Sigstore integration time:
-
Permalink:
Fector101/android_notify@032a454d86d8e2c117011da46ac63670c4c8b20d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Fector101
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@032a454d86d8e2c117011da46ac63670c4c8b20d -
Trigger Event:
workflow_dispatch
-
Statement type: