{"id":23440906,"url":"https://github.com/fector101/android_notify","last_synced_at":"2025-06-18T19:39:46.384Z","repository":{"id":269316396,"uuid":"907034249","full_name":"Fector101/android_notify","owner":"Fector101","description":"A Python package for quickly Creating, Sending \u0026 Managing Android notifications with support for various notifications styles in Kivy apps.","archived":false,"fork":false,"pushed_at":"2025-03-14T18:09:21.000Z","size":484,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T01:05:29.829Z","etag":null,"topics":["android","android-notifications","buildozer","inapp-notifications","kivy","mobile-app-notifications","mobile-development","mobile-development-kit","notifications","post-notification","pyjnius","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fector101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-22T16:19:49.000Z","updated_at":"2025-03-14T18:09:24.000Z","dependencies_parsed_at":"2024-12-22T17:33:14.112Z","dependency_job_id":"6fef6442-e331-4ef1-bd3a-15636e18f00d","html_url":"https://github.com/Fector101/android_notify","commit_stats":null,"previous_names":["fector101/android_notify"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fector101%2Fandroid_notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fector101%2Fandroid_notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fector101%2Fandroid_notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fector101%2Fandroid_notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fector101","download_url":"https://codeload.github.com/Fector101/android_notify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248690998,"owners_count":21146248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-notifications","buildozer","inapp-notifications","kivy","mobile-app-notifications","mobile-development","mobile-development-kit","notifications","post-notification","pyjnius","python"],"created_at":"2024-12-23T16:26:52.971Z","updated_at":"2025-04-13T09:33:20.210Z","avatar_url":"https://github.com/Fector101.png","language":"Python","funding_links":["https://www.buymeacoffee.com/fector101"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cbr\u003e\n    \u003ch1\u003e Android-Notifiy \u003c/h1\u003e\n    \u003cp\u003e A Python library for effortlessly creating and managing Android notifications in Kivy android apps.\u003c/p\u003e\n    \u003cp\u003eSupports various styles and ensures seamless integration and customization.\u003c/p\u003e\n    \u003c!-- \u003cbr\u003e --\u003e\n    \u003c!-- \u003cimg src=\"https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg\"\u003e --\u003e\n\u003c/div\u003e\n\n## Features\n\n- Also Compatible with Android 8.0+.\n- Supports including images in notifications.\n- All Notifications can take Functions (version 1.50+) [functions section](#functions).\n- Advanced Notification Handling [section](#advanced-features).\n- Changing default app notification icon with PNG,\n- Support for multiple notification styles:\n  - [Simple](#basic-usage)\n  - [Progress](#progress-bar-notification)\n  - [Big Picture](#notification-with-an-image-big-picture-style)\n  - [Inbox](#inbox-notification-style)\n  - [Large Icon](#notification-with-an-image-large-icon-style)\n  - [Buttons](#notification-with-buttons)\n  - [Big Text](#big-text-notification)\n\n- persistenting notification [section](#methods)\n\nThis module automatically handles:\n\n- Permission requests for notifications\n- Customizable notification channels.\n- Opening app on notification click\n\n## Installation\n\nThis package is available on PyPI and can be installed via pip:\n\n```bash\npip install android-notify\n```\n\n## **Dependencies**\n\n**Prerequisites:**  \n\n- Kivy\n\nIn your **`buildozer.spec`** file, ensure you include the following:\n\n```ini\n# Add pyjnius so ensure it's packaged with the build\nrequirements = python3, kivy, pyjnius, android-notify\n\n# Add permission for notifications\nandroid.permissions = POST_NOTIFICATIONS\n\n# Required dependencies (write exactly as shown, no quotation marks)\nandroid.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0\nandroid.enable_androidx = True\nandroid.api = 35\n```\n\n---\n\n## Basic Usage\n\n```python\nfrom android_notify import Notification\n\n# Create a simple notification\nnotification = Notification(\n    title=\"Hello\",\n    message=\"This is a basic notification.\"\n)\nnotification.send()\n```\n\n**Sample Image:**  \n![basic notification img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/basicnoti.jpg)\n\n## Notification Styles\n\nThe library supports multiple notification styles:\n\n1. `simple` - Basic notification with title and message\n2. `progress` - Shows a progress bar\n3. `big_picture` - Notification with a large image\n4. `large_icon` - Notification with a custom icon\n5. `both_imgs` - Combines big picture and large icon\n6. `inbox` - List-style notification\n7. `big_text` - Expandable notification with long text\n8. `custom` - For custom notification styles\n\n### Style Examples\n\n#### Progress Bar notification\n\n```python\nfrom kivy.clock import Clock\n\nprogress = 0\n\nnotification = Notification(\n    title=\"Downloading...\", message=\"0% downloaded\",\n    style= \"progress\",\n    progress_current_value=0,progress_max_value=100\n    )\nnotification.send()\n\ndef update_progress(dt):\n    global progress\n    progress = min(progress + 10, 100)\n    notification.updateProgressBar(progress, f\"{progress}% downloaded\")\n    return progress \u003c 100  # Stops when reaching 100%\n\nClock.schedule_interval(update_progress, 3)\n```\n\n**Sample Image:**\n![progress img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/progress.jpg)\n\n#### Images\n\n##### Notification with an Image (Big Picture Style)\n\n\u003e [!NOTE]\n\u003e Online Images should start with `http://` or `https://`  \n\u003e And request for permission, `android.permissions = INTERNET`  \n\u003e No additionally permissions needed for images in App folder\n\n```python\n# Image notification\nnotification = Notification(\n    title='Picture Alert!',\n    message='This notification includes an image.',\n    style=\"big_picture\",\n    big_picture_path=\"assets/imgs/photo.png\"\n)\nnotification.send()\n\n```\n\n**Sample Image:**\n![big_picture img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/bigpicturenoti.jpg)\n\n##### Notification with an Image (Large Icon Style)\n\n```python\nnotification = Notification(\n    title=\"FabianDev_\",\n    message=\"A twitter about some programming stuff\",\n    style=\"large_icon\",\n    large_icon_path=\"assets/imgs/profile.png\"\n)\n\n```\n\n**Sample Image:**  \n![large_icon img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/large_icon.jpg)\n\n#### Inbox Notification Style\n\n```python\n# Send a notification with inbox style\nnotification = Notification(\n    title='Inbox Notification',\n    message='Line 1\\nLine 2\\nLine 3',\n    style='inbox'\n)\nnotification.send()\n\n```\n\n**Sample Image:**\n![Inbox Notification sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/inboxnoti.jpg)\n\n#### Notification with Buttons\n\nHere's a sample of how to add buttons below, To Remove Buttons Simply Call the `removeButtons` method on the Notification Instance\n\n```python\nnotification = Notification(title=\"Jane Dough\", message=\"How to use android-notify #coding #purepython\")\ndef playVideo():\n    print('Playing Video')\n\ndef turnOffNoti():\n    print('Please Turn OFf Noti')\n\ndef watchLater():\n    print('Add to Watch Later')\n\nnotification.addButton(text=\"Play\",on_release=playVideo)\nnotification.addButton(text=\"Turn Off\",on_release=turnOffNoti)\nnotification.addButton(text=\"Watch Later\",on_release=watchLater)\nnotification.send()\n```\n\n**Sample Image:**  \n![btns img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/btns.jpg)\n\n#### Big text notification\n\nWhen using `big_text` style `message` acts as sub-title, Then when notification drop down button is pressed `body` is revealed\n\n```python\nnotification = Notification(\n    title=\"Article\",\n    message=\"Histroy of Loerm Ipsuim\",\n    body=\"Lorem Ipsum is simply dummy text of the printing and ...\",\n    style=\"big_text\"\n)\n```\n\n![big_text img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/big_text.jpg)\n\n## Advanced Features\n\n### Updating Notifications\n\n```python\nnotification = Notification(title=\"Initial Title\")\nnotification.send()\n\n# Update title\nnotification.updateTitle(\"New Title\")\n\n# Update message\nnotification.updateMessage(\"New Message\")\n```\n\n### Progress Bar Management\n\n```python\nnotification = Notification(\n    title=\"Download..\",\n    style=\"progress\"\n)\n# send notification\nnotification.send()\n\n# Update progress\nnotification.updateProgressBar(30, \"30% downloaded\")\n\n# Remove progress bar\n# show_on_update to notification briefly after removed progressbar\nnotification.removeProgressBar(\"Download Complete\",show_on_update=True)\n```\n\n### Adding Style even when already sent\n\nThis is how you add a new style to notification, If already sent or not\n\n```python\nfrom android_notify import NotificationStyles\n\nnotification = Notification(\n    title=\"Download..\",\n    style=\"progress\"\n)\nnotification.send()\n\nnotification.updateTitle(\"Download Completed\")\nnotification.removeProgressBar()\n\n# Add New Style\nnotification.large_icon_path=\"users/imgs/profile1234.png\"\nnotification.addNotificationStyle(NotificationStyles.LARGE_ICON,already_sent=True)\n\n```\n\n### Channel Management\n\nNotifications are organized into channels. You can customize the channel name and ID:\n\n- Custom Channel Name's Gives User ability to turn on/off specific notifications\n\n```python\nnotification = Notification(\n    title=\"Download finished\",\n    message=\"How to Catch a Fish.mp4\",\n    channel_name=\"Download Notifications\",  # Will create User-visible name \"Download Notifications\"\n    channel_id=\"downloads_notifications\"  # Optional: specify custom channel ID\n)\n```\n\n**Sample Image:**  \n![channels img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/channel_name.jpg)\n\n### Silent Notifications\n\nTo send a notification without sound or heads-up display:\n\n```python\nnotification = Notification(title=\"Silent Update\")\nnotification.send(silent=True)\n```\n\n## Functions\n\n```python\nfrom kivymd.app import MDApp\nfrom android_notify import Notification\n\nclass Myapp(MDApp):\n\n    def on_start(self):\n        Notification(title=\"Hello\", message=\"This is a basic notification.\",callback=self.doSomething).send()\n\n    def doSomething(self):\n        print(\"print in Debug Console\")\n```\n\n### Get Which Notification was used to Open App - identifer (str)\n\nIf you just want to get the Exact Notification Clicked to Open App, you can use NotificationHandler to get unique identifer\n\n```python\nfrom kivymd.app import MDApp\nfrom android_notify import Notification, NotificationHandler\n\nclass Myapp(MDApp):\n    \n    def on_start(self):\n        \n        notify = Notification(title=\"Change Page\", message=\"Click to change App page.\", identifer='change_app_page')\n        notify.send()\n\n        notify1 = Notification(title=\"Change Colour\", message=\"Click to change App Colour\", identifer='change_app_color')\n        notify1.send()\n\n    def on_resume(self):\n        # Is called everytime app is reopened\n        notify_identifer = NotificationHandler.getIdentifer()\n        if notify_identifer == 'change_app_page':\n            # Code to change Screen\n            pass\n        elif notify_identifer == 'change_app_color':\n            # Code to change Screen Color\n            pass\n```\n\n### Assist\n\n- Avoiding Human Error when using different notification styles\n\n```python\nfrom android_notify import Notification, NotificationStyles\nNotification(\n    title=\"New Photo\",\n    message=\"Check out this image\",\n    style=NotificationStyles.BIG_PICTURE,\n    big_picture_path=\"assets/imgs/photo.png\"\n).send()\n```\n\n#### To Use New Version Of Android-Notify\n\nTo be safe Delete All Old Versions of Android-Notify from `.buildozer` directory\n\n##### On Linux run\n\n`cd .buildozer \u0026\u0026 find . -type d -name \"android_notify*\" -print0 | xargs -0 rm -r \u0026\u0026 cd ..`\n\n##### On Windows (PowerShell) run\n\n- If command prints right folder paths Replace `Write-Output` with `Remove-Item`\n\n```sh\ncd .buildozer\nGet-ChildItem -Path . -Directory -Filter \"android_notify*\" | ForEach-Object { Write-Output $_.FullName }\ncd ..\n```\n\n##### On Windows Git Bash (if installed)\n\n`cd .buildozer \u0026\u0026 find . -type d -name \"android_notify*\" -print0 | xargs -0 rm -r \u0026\u0026 cd ..`\n\n##### On macOS run\n\n`cd .buildozer \u0026\u0026 find . -type d -name \"android_notify*\" -exec rm -r {} + \u0026\u0026 cd ..`\n\n### Development Mode\n\n#### For Logs\n\nWhen developing on non-Android platforms, the library provides debugging output:\n\n```python\n# Enable logs (default is True when not on Android)\nNotification.logs = True\n\n# Create notification for testing\nnotification = Notification(title=\"Test\")\nnotification.send()\n# Will print notification properties instead of sending\n```\n\n### Methods\n\n### Instance.**init**\n\nargs\n\n- app_icon: If not specified defaults to app icon, To Change Default app icon use PNG format Or Image Will display as a Black Box\n\n### Instance.send\n\nargs\n\n- persistent : To make notification stay after user clicks clear All\n- close_on_click : To close notification on click\n\n### Instance.addButton\n\nargs\n\n- text : Button Text\n\n### Instance.updateTitle\n\nargs\n\n- new_title : String to be set as New notification Title\n\n### Instance.updateMessage\n\nargs\n\n- new_message : String to be set as New notification Message\n\n### Instance.showInfiniteProgressBar\n\nDisplays an Infinite Progress Bar in Notification, Can be Removed using `removeProgressBar` and updated using `updateProgressBar` method\n\n### Instance.updateProgressBar\n\nif updating title,msg with progressbar frequenlty pass them in too to avoid update issues.\nAccording to android docs updates shouldn't be too frequent.\n\n`updateProgressBar` has a built-in delay of 0.5 secs\n\nargs\n\n- current_value (str): the value from progressbar current progress\n- message (str,optional): defaults to last message\n- title (str,optional): defaults to last title\n\n### Instance.removeProgressBar\n\nThis Removes Progress bar\n\nargs\n\n- message (str, optional): notification message, Defaults to 'last message'.\n- show_on_update (bool, optional): To show notification brifely when progressbar removed. Defaults to True.\n- title (str, optional): notification title, Defaults to 'last title'.\n\n### Instance.addNotificationStyle\n\nThis is useful to add style after Notification is sent or Add more styles to Notification\nargs\n\n- style: choosen style. All options are in the `NotificationStyles` class `['simple','progress','inbox','big_text','large_icon','big_picture','both_imgs]`\n- already_sent: specfiy if notification.send() method has already been called, it defaults to false\n\n## Image Requirements\n\n- Online Images should start with `http://` or `https://`\n- Local Images must be located within your app's folder\n\n## Error Handling\n\nThe library validates arguments and provides helpful error messages:\n\n- Invalid style names will suggest the closest matching style\n- Invalid arguments will list all valid options\n- Missing image files will list all files in App Directory\n\n## Limitation\n\n1. Only works on Android devices\n\n## Best Practices\n\n1. Always handle permissions appropriately\n2. use `NotificationStyles` to set `style`, use `style=NotificationStyles.LARGE_ICON` instead of `style=\"large_icon\"`\n3. Use meaningful channel names for organization\n4. Keep progress bar updates reasonable (don't update too frequently)\n5. Test notifications on different Android versions\n6. Consider using silent notifications for frequent updates\n\n## Debugging Tips\n\n1. Enable logs during development: `Notification.logs = True`\n2. Check channel creation with Android's notification settings\n3. Verify image paths before sending notifications\n4. Test different styles to ensure proper display\n\nRemember to check Android's notification documentation for best practices and guidelines regarding notification frequency and content.\n\n## Contribution\n\nFeel free to open issues or submit pull requests for improvements!\n\n## Reporting Issues\n\nFound a bug? Please open an issue on our [GitHub Issues](https://github.com/Fector101/android_notify/issues) page.\n\n## Author\n\n- Fabian - \u003cfector101@yahoo.com\u003e\n- GitHub: [Android Notify Repo](https://github.com/Fector101/android_notify)\n- Twitter: [FabianDev_](https://twitter.com/intent/user?user_id=1246911115319263233)\n\nFor feedback or contributions, feel free to reach out!\n\n---\n\n## ☕ Support the Project\n\nIf you find this project helpful, consider buying me a coffee! 😊 Or Giving it a star on 🌟 [GitHub](https://github.com/Fector101/android_notify/) Your support helps maintain and improve the project.\n\n\u003ca href=\"https://www.buymeacoffee.com/fector101\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"60\"\u003e\n\u003c/a\u003e\n\n---\n\n## Acknowledgments\n\n- This Project was thoroughly Tested by the [Laner Project](https://github.com/Fector101/Laner/) - A application for Securely Transfering Files Wirelessly between your PC and Phone.\n- Thanks to the Kivy and Pyjnius communities.\n\n---\n\n## 🌐 **Links**\n\n- **PyPI:** [android-notify on PyPI](https://pypi.org/project/android-notify/)\n- **GitHub:** [Source Code Repository](https://github.com/Fector101/android_notify/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffector101%2Fandroid_notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffector101%2Fandroid_notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffector101%2Fandroid_notify/lists"}