Skip to main content

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.

PyPI PyPI Downloads

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:

Quick Start

from android_notify import Notification

# Simple notification
Notification(
    title="Hello",
    message="This is a basic notification."
).send()

Sample Image:
basic notification img sample

Installation

Kivy apps:

In your buildozer.spec file, ensure you include the following:

# Add requirements list
requirements = python3, kivy, pyjnius, android-notify
# Add permission for notifications
android.permissions = POST_NOTIFICATIONS
Flet apps:

In your pyproject.toml file, ensure you include the following:

[tool.flet.android]
dependencies = [
  "pyjnius", "android-notify"
]

[tool.flet.android.permission]
"android.permission.POST_NOTIFICATIONS" = true
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 name paste android-notify
  • Minimal working example
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from android_notify import Notification, NotificationHandler


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):
        NotificationHandler.asks_permission()

    def send_notification(self, *args):
        Notification(
            title="Hello from Android Notify",
            message="This is a basic notification."
        ).send()


if __name__ == "__main__":
    AndroidNotifyDemoApp().run()
Desktop

For IDE IntelliSense Can be installed via pip install:

pip install android_notify
android-notify -v
For Agents Full Api Reference: https://android-notify.vercel.app/api/android-notify-v1.60-api.md

Common Methods

For full visit documentation for more examples and advanced usage.

For Images

Source can be local file paths or complete URLs execpt setSmallIcon which only accepts local png files.

  • setBigPicture - shows below when user clicks drop button
  • setLargeIcon - appears at right side of notification content
  • setSmallIcon - changes app icon to a custom png
  • setColor - changes app icon backgroud Color

For online images URL should with https:// and you need internet permission android.permissions = INTERNET in buildozer.spec or pyproject.toml

from android_notify import Notification

notification = Notification(
    title='Picture Alert!',
    message='This notification uses setLargelcon and setBig Picture method.'
)
notification.setBigPicture("imgs/photo.png")
notification.setLargeIcon("imgs/profile.png")
notification.send()

Sample Image:
basic notification img sample

from android_notify import Notification

notification = Notification(
    title='Custom Icon and Color',
    message='This notification uses setColor and setSmallIcon.'
)
notification.setColor("red")
notification.setSmallIcon("love.png")
notification.send()

Sample Image:
basic notification img sample

For ProgressBar

  • updateProgressBar(current_value, message, title) - update progress in real-time
  • showInfiniteProgressBar - shows an infinite progress animation.
  • removeProgressBar(message, show_on_update=True, title) - Cleanly remove the progress bar.
from android_notify import Notification
from kivy.clock import Clock

progress = 0

notification = Notification(
    title="Downloading...", message="0% downloaded",
    progress_current_value=0, progress_max_value=100
)
notification.send()

def update_progress(dt):
    global progress
    progress = min(progress + 10, 100)
    
    if progress==100:
        notification.removeProgressBar(title="File Downloaded", message="super_large_file.zip")
    elif progress >= 80:
        notification.showInfiniteProgressBar()
    else:
        notification.updateProgressBar(progress, f"{progress}% downloaded")

    return progress < 100  # Ends loop when reaching 100%

Clock.schedule_interval(update_progress, 3)

progressbar img sample

For texts

  • addLine - adds a line to the notification, useful for inbox style
  • setSubText - sets a smaller text that appears at the side of app name
  • setBigText - sets a longer text that appears when the notification is expanded
  • updateTitle - updates the title text of the notification
  • updateMessage - updates the main message text of the notification
from android_notify import Notification

notification = Notification(
    title="5 New mails from Frank",
    message="Check them out",
)
notification.setSubText("FabianCodes")
notification.setLargeIcon("imgs/profile.png")
notification.addLine("Re: Planning")
notification.addLine("Delivery on its way")
notification.addLine("Follow-up")
notification.send()

inbox-subtext img sample

Documentation

For full documentation, examples, and advanced usage, API reference visit the documentation


For Dev Version usage

requirements = python3, kivy, pyjnius, https://github.com/Fector101/android_notify/archive/main.zip

Dev Features docs

To use Custom Sounds

Option 1: Audio files bundled in res/raw

  • Put audio files in res/raw folder,
  • Then from buildozer.spec point to res folder android.add_resources = res
  • and includes it's format source.include_exts = wav.

Lastly From the code

# Create a custom notification channel with a unique sound resource for android 8+
Notification.createChannel(
    id="weird_sound_tester",
    name="Weird Sound Tester",
    description="A test channel for custom sounds from the res/raw folder.",
    res_sound_name="sneeze" # file name without .wav or .mp3
)

# Send a notification through the created channel
n=Notification(
    title="Custom Sound Notification",
    message="This tests playback of a custom sound (sneeze.wav) stored in res/raw.",
    channel_id="weird_sound_tester" # important tells notification to use right channel
)
n.setSound("sneeze")# for android 7 below 
n.send()

Option 2: Local file path or URI (sound_path)

You can use a local audio file, a content://, file://, or android.resource:// URI directly:

# Using a local file path
Notification.createChannel(
    id="local_sound",
    name="Local Sound",
    sound_path="/storage/emulated/0/Download/alert.mp3"
)

# Using a content URI (e.g., from media store)
Notification.createChannel(
    id="uri_sound",
    name="URI Sound",
    sound_path="content://media/external/audio/media/123"
)

# Send notification with custom sound path
n = Notification(
    title="Custom Sound",
    message="Playing from local path",
    channel_id="local_sound"
)
n.setSound(sound_path="/storage/emulated/0/Download/alert.mp3")
n.send()

Private files (e.g., in app's data/ directory) are automatically copied to external storage before playing.

Add Data to Notification
  • NotificationHandler.data_object returns a dict of data in the clicked notification
  • setData can also be called after send to change data_object stored
  • Use name if value is constant Notification(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)
How to control popups
from android_notify import Notification
import time

notification = Notification(
    title="Processing...",
    message="Starting task"
)

notification.send()
time.sleep(10)

# show heads-up when updated
notification.setOnlyAlertOnce(False)

notification.updateTitle("Processing Complete!")
notification.updateMessage("Task finished successfully")

☕ Support the Project

If you find this project helpful, consider buying me a coffee! 😊
Or Giving it a star on 🌟 GitHub Your support helps maintain and improve the project.

Buy Me A Coffee

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

android_notify-1.61.6.tar.gz (100.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

android_notify-1.61.6-py3-none-any.whl (111.6 kB view details)

Uploaded Python 3

File details

Details for the file android_notify-1.61.6.tar.gz.

File metadata

  • Download URL: android_notify-1.61.6.tar.gz
  • Upload date:
  • Size: 100.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for android_notify-1.61.6.tar.gz
Algorithm Hash digest
SHA256 cc4d58be7e48a4a7b4fc8626807717bdb51c006d75e3e6c2ed10458a3050470c
MD5 efed182d47a80c1338aa8fc4ee1c2b5e
BLAKE2b-256 6dc7b4e4258c2bfa3bc74955164dc1e32b45a0ad8483190feb3ef4e89c589d0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for android_notify-1.61.6.tar.gz:

Publisher: publish.yml on Fector101/android_notify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file android_notify-1.61.6-py3-none-any.whl.

File metadata

  • Download URL: android_notify-1.61.6-py3-none-any.whl
  • Upload date:
  • Size: 111.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for android_notify-1.61.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5d1500b83026964df0dc4d690c65f99299e6bcec61641fecf5adac7c149a6080
MD5 3402715e5211de962b07ee733a8c3fd5
BLAKE2b-256 32822bbad4a5d8b773b10848d880785b092d5ffbf81e48809605d803b08c0658

See more details on using hashes here.

Provenance

The following attestation bundles were made for android_notify-1.61.6-py3-none-any.whl:

Publisher: publish.yml on Fector101/android_notify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.61.6 This release

2 files

1.61.5

2 files

1.61.4

2 files

1.61.3

2 files

1.61.0

2 files

1.60.10

2 files

1.60.9

2 files

1.60.8

2 files

1.60.7

2 files

1.60.6

2 files

1.60.5

2 files

1.60.4

2 files

1.60.3

2 files

1.60.2

2 files

1.59.4

2 files

1.59.3

2 files

1.59.2

2 files

1.59.1

2 files

1.59

2 files

1.58

2 files

1.57.1

2 files

1.57

2 files

1.56

2 files

1.55

2 files

1.54.1

2 files

1.54

2 files

1.53.1

2 files

1.53

2 files

1.52.5

2 files

1.52.4

2 files

1.52.3

2 files

1.52.2

2 files

1.52.1

2 files

1.52

2 files

1.51.3

2 files

1.51.2

2 files

1.51.1

2 files

1.51

2 files

1.50.1

2 files

1.50

2 files

1.41

2 files

1.40.1

2 files

1.40

2 files

1.32.1

2 files

1.32

2 files

1.31

2 files

1.30

2 files

1.24.4

2 files

1.24.3

2 files

1.24.2

2 files

1.24.1

2 files

1.24

2 files

1.23.1

2 files

1.23

2 files

1.21

2 files

1.5

2 files

1.3

2 files

1.2

2 files

1.1

2 files

1.0

2 files

0.3

2 files

0.2

2 files

0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page