android-notify 1.59.2__tar.gz → 1.59.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of android-notify might be problematic. Click here for more details.
- {android_notify-1.59.2 → android_notify-1.59.4}/PKG-INFO +119 -119
- android_notify-1.59.4/android_notify/an_utils.py +18 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify/base.py +1 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify/sword.py +102 -36
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify.egg-info/PKG-INFO +119 -119
- {android_notify-1.59.2 → android_notify-1.59.4}/setup.cfg +4 -4
- {android_notify-1.59.2 → android_notify-1.59.4}/setup.py +1 -1
- android_notify-1.59.2/android_notify/an_utils.py +0 -10
- {android_notify-1.59.2 → android_notify-1.59.4}/README.md +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify/__init__.py +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify/__main__.py +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify/an_types.py +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify/core.py +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify/styles.py +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify.egg-info/SOURCES.txt +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify.egg-info/dependency_links.txt +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify.egg-info/requires.txt +0 -0
- {android_notify-1.59.2 → android_notify-1.59.4}/android_notify.egg-info/top_level.txt +0 -0
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: android-notify
|
|
3
|
-
Version: 1.59.
|
|
4
|
-
Summary: A Python package that simplifies creating Android notifications in Kivy apps.
|
|
5
|
-
Home-page: https://android-notify.vercel.app
|
|
6
|
-
Author: Fabian
|
|
7
|
-
Author-email: fector101@yahoo.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Project-URL: Documentation, https://android-notify.vercel.app/
|
|
10
|
-
Project-URL: Source, https://github.com/fector101/android-notify
|
|
11
|
-
Project-URL: Tracker, https://github.com/fector101/android-notify/issues
|
|
12
|
-
Project-URL: Funding, https://www.buymeacoffee.com/fector101
|
|
13
|
-
Keywords: android,notifications,kivy,mobile,post-notifications,pyjnius,android-notifications,kivy-notifications,python-android,mobile-development,push-notifications,mobile-app,kivy-application
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: Operating System :: Android
|
|
17
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
18
|
-
Classifier: Intended Audience :: Developers
|
|
19
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Requires-Python: >=3.6
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: kivy>=2.0.0
|
|
23
|
-
Requires-Dist: pyjnius>=1.4.2
|
|
24
|
-
Dynamic: author
|
|
25
|
-
Dynamic: author-email
|
|
26
|
-
Dynamic: classifier
|
|
27
|
-
Dynamic: description
|
|
28
|
-
Dynamic: description-content-type
|
|
29
|
-
Dynamic: home-page
|
|
30
|
-
Dynamic: keywords
|
|
31
|
-
Dynamic: license
|
|
32
|
-
Dynamic: project-url
|
|
33
|
-
Dynamic: requires-dist
|
|
34
|
-
Dynamic: requires-python
|
|
35
|
-
Dynamic: summary
|
|
36
|
-
|
|
37
|
-
<div align="center">
|
|
38
|
-
<br>
|
|
39
|
-
<h1> Android-Notify </h1>
|
|
40
|
-
<p><a href='https://android-notify.vercel.app'>Android Notify</a> is a Python library for effortlessly creating and managing Android notifications in Kivy apps.</p>
|
|
41
|
-
<p>Supports various styles and ensures seamless integration, customization and Pythonic APIs.</p>
|
|
42
|
-
<!-- <br> -->
|
|
43
|
-
<!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
|
|
44
|
-
</div>
|
|
45
|
-
<!-- Channel [CRUD]
|
|
46
|
-
The Android Notify package provides a simple yet comprehensive way to create and manage rich notifications on Android devices directly from your Python code. This library bridges the gap between Python and Android's notification system, giving you full control over notifications with a clean, Pythonic API. -->
|
|
47
|
-
|
|
48
|
-
## Features
|
|
49
|
-
|
|
50
|
-
- **Multiple Notification Styles**: Support for various notification styles including:
|
|
51
|
-
- Simple text notifications
|
|
52
|
-
- Progress bar notifications (determinate and indeterminate)
|
|
53
|
-
- Big text notifications
|
|
54
|
-
- Inbox-style notifications
|
|
55
|
-
- Large icon notifications
|
|
56
|
-
- Big picture notifications
|
|
57
|
-
- Combined image styles
|
|
58
|
-
|
|
59
|
-
- **Rich Functionality**:
|
|
60
|
-
- Add action buttons with custom callbacks
|
|
61
|
-
- Update notification content dynamically
|
|
62
|
-
- Manage progress bars with fine-grained control
|
|
63
|
-
- Custom notification Icon
|
|
64
|
-
- Custom notification channels for Android 8.0+ (Creating and Deleting)
|
|
65
|
-
- Silent notifications
|
|
66
|
-
- Persistent notifications
|
|
67
|
-
- Click handlers and callbacks
|
|
68
|
-
- Cancel Notifications
|
|
69
|
-
|
|
70
|
-
## Quick Start
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from android_notify import Notification
|
|
74
|
-
|
|
75
|
-
# Simple notification
|
|
76
|
-
Notification(
|
|
77
|
-
title="Hello",
|
|
78
|
-
message="This is a basic notification."
|
|
79
|
-
).send()
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**Sample Image:**
|
|
84
|
-

|
|
85
|
-
|
|
86
|
-
## Installation
|
|
87
|
-
|
|
88
|
-
In your **`buildozer.spec`** file, ensure you include the following:
|
|
89
|
-
|
|
90
|
-
```ini
|
|
91
|
-
# Add pyjnius so ensure it's packaged with the build
|
|
92
|
-
requirements = python3, kivy, pyjnius, android-notify
|
|
93
|
-
# Add permission for notifications
|
|
94
|
-
android.permissions = POST_NOTIFICATIONS
|
|
95
|
-
|
|
96
|
-
# Required dependencies (write exactly as shown, no quotation marks)
|
|
97
|
-
android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
|
|
98
|
-
android.enable_androidx = True
|
|
99
|
-
android.api = 35
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Can be installed via `pip` For testing purposes:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
pip install android_notify
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Documentation
|
|
109
|
-
|
|
110
|
-
For full documentation, examples, and advanced usage, API reference visit the
|
|
111
|
-
[documentation](https://android-notify.vercel.app)
|
|
112
|
-
|
|
113
|
-
## ☕ Support the Project
|
|
114
|
-
|
|
115
|
-
If 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.
|
|
116
|
-
|
|
117
|
-
<a href="https://www.buymeacoffee.com/fector101" target="_blank">
|
|
118
|
-
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
|
|
119
|
-
</a>
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: android-notify
|
|
3
|
+
Version: 1.59.4
|
|
4
|
+
Summary: A Python package that simplifies creating Android notifications in Kivy apps.
|
|
5
|
+
Home-page: https://android-notify.vercel.app
|
|
6
|
+
Author: Fabian
|
|
7
|
+
Author-email: fector101@yahoo.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://android-notify.vercel.app/
|
|
10
|
+
Project-URL: Source, https://github.com/fector101/android-notify
|
|
11
|
+
Project-URL: Tracker, https://github.com/fector101/android-notify/issues
|
|
12
|
+
Project-URL: Funding, https://www.buymeacoffee.com/fector101
|
|
13
|
+
Keywords: android,notifications,kivy,mobile,post-notifications,pyjnius,android-notifications,kivy-notifications,python-android,mobile-development,push-notifications,mobile-app,kivy-application
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: Android
|
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.6
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: kivy>=2.0.0
|
|
23
|
+
Requires-Dist: pyjnius>=1.4.2
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: author-email
|
|
26
|
+
Dynamic: classifier
|
|
27
|
+
Dynamic: description
|
|
28
|
+
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: keywords
|
|
31
|
+
Dynamic: license
|
|
32
|
+
Dynamic: project-url
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
<div align="center">
|
|
38
|
+
<br>
|
|
39
|
+
<h1> Android-Notify </h1>
|
|
40
|
+
<p><a href='https://android-notify.vercel.app'>Android Notify</a> is a Python library for effortlessly creating and managing Android notifications in Kivy apps.</p>
|
|
41
|
+
<p>Supports various styles and ensures seamless integration, customization and Pythonic APIs.</p>
|
|
42
|
+
<!-- <br> -->
|
|
43
|
+
<!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
|
|
44
|
+
</div>
|
|
45
|
+
<!-- Channel [CRUD]
|
|
46
|
+
The Android Notify package provides a simple yet comprehensive way to create and manage rich notifications on Android devices directly from your Python code. This library bridges the gap between Python and Android's notification system, giving you full control over notifications with a clean, Pythonic API. -->
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **Multiple Notification Styles**: Support for various notification styles including:
|
|
51
|
+
- Simple text notifications
|
|
52
|
+
- Progress bar notifications (determinate and indeterminate)
|
|
53
|
+
- Big text notifications
|
|
54
|
+
- Inbox-style notifications
|
|
55
|
+
- Large icon notifications
|
|
56
|
+
- Big picture notifications
|
|
57
|
+
- Combined image styles
|
|
58
|
+
|
|
59
|
+
- **Rich Functionality**:
|
|
60
|
+
- Add action buttons with custom callbacks
|
|
61
|
+
- Update notification content dynamically
|
|
62
|
+
- Manage progress bars with fine-grained control
|
|
63
|
+
- Custom notification Icon
|
|
64
|
+
- Custom notification channels for Android 8.0+ (Creating and Deleting)
|
|
65
|
+
- Silent notifications
|
|
66
|
+
- Persistent notifications
|
|
67
|
+
- Click handlers and callbacks
|
|
68
|
+
- Cancel Notifications
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from android_notify import Notification
|
|
74
|
+
|
|
75
|
+
# Simple notification
|
|
76
|
+
Notification(
|
|
77
|
+
title="Hello",
|
|
78
|
+
message="This is a basic notification."
|
|
79
|
+
).send()
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Sample Image:**
|
|
84
|
+

|
|
85
|
+
|
|
86
|
+
## Installation
|
|
87
|
+
|
|
88
|
+
In your **`buildozer.spec`** file, ensure you include the following:
|
|
89
|
+
|
|
90
|
+
```ini
|
|
91
|
+
# Add pyjnius so ensure it's packaged with the build
|
|
92
|
+
requirements = python3, kivy, pyjnius, android-notify
|
|
93
|
+
# Add permission for notifications
|
|
94
|
+
android.permissions = POST_NOTIFICATIONS
|
|
95
|
+
|
|
96
|
+
# Required dependencies (write exactly as shown, no quotation marks)
|
|
97
|
+
android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
|
|
98
|
+
android.enable_androidx = True
|
|
99
|
+
android.api = 35
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Can be installed via `pip` For testing purposes:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install android_notify
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Documentation
|
|
109
|
+
|
|
110
|
+
For full documentation, examples, and advanced usage, API reference visit the
|
|
111
|
+
[documentation](https://android-notify.vercel.app)
|
|
112
|
+
|
|
113
|
+
## ☕ Support the Project
|
|
114
|
+
|
|
115
|
+
If 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.
|
|
116
|
+
|
|
117
|
+
<a href="https://www.buymeacoffee.com/fector101" target="_blank">
|
|
118
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
|
|
119
|
+
</a>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Collection of useful functions"""
|
|
2
|
+
|
|
3
|
+
import inspect
|
|
4
|
+
def can_accept_arguments(func, *args, **kwargs):
|
|
5
|
+
try:
|
|
6
|
+
sig = inspect.signature(func)
|
|
7
|
+
sig.bind(*args, **kwargs)
|
|
8
|
+
return True
|
|
9
|
+
except TypeError:
|
|
10
|
+
return False
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run_on_ui_thread(func):
|
|
14
|
+
"""Fallback for Developing on PC"""
|
|
15
|
+
def wrapper(*args, **kwargs):
|
|
16
|
+
# print("Simulating run on UI thread")
|
|
17
|
+
return func(*args, **kwargs)
|
|
18
|
+
return wrapper
|
|
@@ -19,9 +19,16 @@ try:
|
|
|
19
19
|
from android.config import ACTIVITY_CLASS_NAME
|
|
20
20
|
from android.runnable import run_on_ui_thread
|
|
21
21
|
|
|
22
|
+
try:
|
|
23
|
+
from android import config
|
|
24
|
+
ns = config.JAVA_NAMESPACE
|
|
25
|
+
# print('This is Java name space:',ns)
|
|
26
|
+
except (ImportError,AttributeError):
|
|
27
|
+
ns='org.kivy.android'
|
|
28
|
+
|
|
22
29
|
# Get the required Java classes needs to on android to import
|
|
23
30
|
Bundle = autoclass('android.os.Bundle')
|
|
24
|
-
PythonActivity = autoclass('
|
|
31
|
+
PythonActivity = autoclass(ns+'.PythonActivity')
|
|
25
32
|
String = autoclass('java.lang.String')
|
|
26
33
|
Intent = autoclass('android.content.Intent')
|
|
27
34
|
PendingIntent = autoclass('android.app.PendingIntent')
|
|
@@ -43,12 +50,7 @@ except Exception as e:
|
|
|
43
50
|
# print(MESSAGE) Already Printing in core.py
|
|
44
51
|
|
|
45
52
|
# This is so no crashes when developing on PC
|
|
46
|
-
|
|
47
|
-
"""Fallback for Developing on PC"""
|
|
48
|
-
def wrapper(*args, **kwargs):
|
|
49
|
-
# print("Simulating run on UI thread")
|
|
50
|
-
return func(*args, **kwargs)
|
|
51
|
-
return wrapper
|
|
53
|
+
from .an_utils import run_on_ui_thread
|
|
52
54
|
|
|
53
55
|
if ON_ANDROID:
|
|
54
56
|
try:
|
|
@@ -63,6 +65,7 @@ if ON_ANDROID:
|
|
|
63
65
|
NotificationCompatBigTextStyle = autoclass('androidx.core.app.NotificationCompat$BigTextStyle')
|
|
64
66
|
NotificationCompatBigPictureStyle = autoclass('androidx.core.app.NotificationCompat$BigPictureStyle')
|
|
65
67
|
NotificationCompatInboxStyle = autoclass('androidx.core.app.NotificationCompat$InboxStyle')
|
|
68
|
+
# NotificationCompatDecoratedCustomViewStyle = autoclass('androidx.core.app.NotificationCompat$DecoratedCustomViewStyle')
|
|
66
69
|
except Exception as e:
|
|
67
70
|
print(e)
|
|
68
71
|
print("""
|
|
@@ -86,6 +89,7 @@ class Notification(BaseNotification):
|
|
|
86
89
|
:param progress_current_value: integer To set progress bar current value.
|
|
87
90
|
:param progress_max_value: integer To set Max range for progress bar.
|
|
88
91
|
:param body: large text For `big_Text` style, while `message` acts as subtitle.
|
|
92
|
+
:param lines_txt: text separated by newLine symbol For `inbox` style `use addLine method instead`
|
|
89
93
|
---
|
|
90
94
|
(Advance Options)
|
|
91
95
|
:param id: Pass in Old 'id' to use old instance
|
|
@@ -101,6 +105,7 @@ class Notification(BaseNotification):
|
|
|
101
105
|
button_ids=[0]
|
|
102
106
|
btns_box={}
|
|
103
107
|
main_functions={}
|
|
108
|
+
passed_check = False
|
|
104
109
|
|
|
105
110
|
# During Development (When running on PC)
|
|
106
111
|
BaseNotification.logs=not ON_ANDROID
|
|
@@ -119,6 +124,11 @@ class Notification(BaseNotification):
|
|
|
119
124
|
self.__built_parameter_filled=False
|
|
120
125
|
self.__using_set_priority_method=False
|
|
121
126
|
|
|
127
|
+
# For components
|
|
128
|
+
self.__lines = []
|
|
129
|
+
self.__builder = None # want to make builder always available for getter
|
|
130
|
+
self.notification_manager = None
|
|
131
|
+
|
|
122
132
|
self.__format_channel(self.channel_name, self.channel_id)
|
|
123
133
|
if not ON_ANDROID:
|
|
124
134
|
return
|
|
@@ -128,6 +138,9 @@ class Notification(BaseNotification):
|
|
|
128
138
|
self.notification_manager = cast(NotificationManager, notification_service)
|
|
129
139
|
self.__builder = NotificationCompatBuilder(context, self.channel_id)
|
|
130
140
|
|
|
141
|
+
def addLine(self,text:str):
|
|
142
|
+
self.__lines.append(text)
|
|
143
|
+
|
|
131
144
|
def cancel(self,_id=0):
|
|
132
145
|
"""
|
|
133
146
|
Removes a Notification instance from tray
|
|
@@ -205,6 +218,7 @@ class Notification(BaseNotification):
|
|
|
205
218
|
if self.__built_parameter_filled:
|
|
206
219
|
# Don't dispatch before filling required values `self.__create_basic_notification`
|
|
207
220
|
# We generally shouldn't dispatch till user call .send()
|
|
221
|
+
self.__applyNewLinesIfAny()
|
|
208
222
|
self.__dispatch_notification()
|
|
209
223
|
|
|
210
224
|
def setBigPicture(self,path):
|
|
@@ -408,29 +422,51 @@ class Notification(BaseNotification):
|
|
|
408
422
|
persistent (bool): True To not remove Notification When User hits clears All notifications button
|
|
409
423
|
close_on_click (bool): True if you want Notification to be removed when clicked
|
|
410
424
|
"""
|
|
411
|
-
self.silent= silent or self.silent
|
|
425
|
+
self.silent = silent or self.silent
|
|
412
426
|
if ON_ANDROID:
|
|
413
427
|
self.__start_notification_build(persistent, close_on_click)
|
|
414
428
|
self.__dispatch_notification()
|
|
429
|
+
|
|
430
|
+
self.__send_logs()
|
|
431
|
+
|
|
432
|
+
def send_(self,silent:bool=False,persistent=False,close_on_click=True):
|
|
433
|
+
"""Sends notification without checking for additional notification permission
|
|
415
434
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
435
|
+
Args:
|
|
436
|
+
silent (bool): True if you don't want to show briefly on screen
|
|
437
|
+
persistent (bool): True To not remove Notification When User hits clears All notifications button
|
|
438
|
+
close_on_click (bool): True if you want Notification to be removed when clicked
|
|
439
|
+
"""
|
|
440
|
+
self.passed_check = True
|
|
441
|
+
self.send(silent,persistent,close_on_click)
|
|
442
|
+
|
|
443
|
+
def __send_logs(self):
|
|
444
|
+
if not self.logs:
|
|
445
|
+
return
|
|
446
|
+
string_to_display=''
|
|
447
|
+
print("\n Sent Notification!!!")
|
|
448
|
+
displayed_args = [
|
|
449
|
+
"title", "message",
|
|
450
|
+
"style", "body", "large_icon_path", "big_picture_path",
|
|
451
|
+
"progress_max_value",
|
|
452
|
+
'name', "channel_name",
|
|
453
|
+
]
|
|
454
|
+
is_progress_not_default = isinstance(self.progress_current_value, int) or (isinstance(self.progress_current_value, float) and self.progress_current_value != 0.0)
|
|
455
|
+
for name,value in vars(self).items():
|
|
456
|
+
if value and name in displayed_args:
|
|
457
|
+
if name == "progress_max_value":
|
|
458
|
+
if is_progress_not_default:
|
|
459
|
+
string_to_display += f'\n progress_current_value: {self.progress_current_value}, {name}: {value}'
|
|
460
|
+
elif name == "channel_name":
|
|
461
|
+
string_to_display += f'\n {name}: {value}, channel_id: {self.channel_id}'
|
|
462
|
+
else:
|
|
463
|
+
string_to_display += f'\n {name}: {value}'
|
|
464
|
+
|
|
465
|
+
string_to_display +="\n (Won't Print Logs When Complied,except if selected `Notification.logs=True`)"
|
|
466
|
+
print(string_to_display)
|
|
429
467
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if DEV:
|
|
433
|
-
print(f'channel_name: {self.channel_name}, Channel ID: {self.channel_id}, __id: {self.__id}')
|
|
468
|
+
def builder(self):
|
|
469
|
+
return self.__builder
|
|
434
470
|
|
|
435
471
|
def addButton(self, text:str,on_release):
|
|
436
472
|
"""For adding action buttons
|
|
@@ -508,11 +544,9 @@ class Notification(BaseNotification):
|
|
|
508
544
|
if style == NotificationStyles.BIG_TEXT:
|
|
509
545
|
self.setBigText(self.body)
|
|
510
546
|
|
|
511
|
-
elif style == NotificationStyles.INBOX:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
inbox_style.addLine(str(line))
|
|
515
|
-
self.__builder.setStyle(inbox_style)
|
|
547
|
+
elif style == NotificationStyles.INBOX and self.lines_txt:
|
|
548
|
+
lines = self.lines_txt.split("\n")
|
|
549
|
+
self.setLines(lines)
|
|
516
550
|
|
|
517
551
|
elif (style == NotificationStyles.LARGE_ICON and self.large_icon_path) or (style == NotificationStyles.BIG_PICTURE and self.big_picture_path):
|
|
518
552
|
img = self.large_icon_path if style == NotificationStyles.LARGE_ICON else self.big_picture_path
|
|
@@ -532,9 +566,29 @@ class Notification(BaseNotification):
|
|
|
532
566
|
|
|
533
567
|
return True
|
|
534
568
|
|
|
569
|
+
def setLines(self, lines: list):
|
|
570
|
+
"""Pass in a list of strings to be used for lines"""
|
|
571
|
+
if not lines:
|
|
572
|
+
return
|
|
573
|
+
if ON_ANDROID:
|
|
574
|
+
inbox_style = NotificationCompatInboxStyle()
|
|
575
|
+
for line in lines:
|
|
576
|
+
inbox_style.addLine(str(line))
|
|
577
|
+
self.__builder.setStyle(inbox_style)
|
|
578
|
+
print('Set Lines: ', lines)
|
|
579
|
+
|
|
580
|
+
if self.logs:
|
|
581
|
+
print('Added Lines: ', lines)
|
|
582
|
+
|
|
535
583
|
def __dispatch_notification(self):
|
|
536
|
-
|
|
537
|
-
|
|
584
|
+
# self.passed_check is for self.send_() some devices don't return true when checking for permission when it's actually True in settings
|
|
585
|
+
# And so users can do Notification.passed_check = True at top of their file and use regular .send()
|
|
586
|
+
if self.passed_check or NotificationHandler.has_permission():
|
|
587
|
+
try:
|
|
588
|
+
self.notification_manager.notify(self.__id, self.__builder.build())
|
|
589
|
+
except Exception as notify_error:
|
|
590
|
+
print('Exception:', notify_error)
|
|
591
|
+
print('Failed to send traceback:', traceback.format_exc())
|
|
538
592
|
else:
|
|
539
593
|
print('Permission not granted to send notifications')
|
|
540
594
|
# Not asking for permission too frequently, This makes dialog popup to stop showing
|
|
@@ -544,6 +598,12 @@ class Notification(BaseNotification):
|
|
|
544
598
|
self.__create_basic_notification(persistent, close_on_click)
|
|
545
599
|
if self.style not in ['simple','']:
|
|
546
600
|
self.addNotificationStyle(self.style)
|
|
601
|
+
self.__applyNewLinesIfAny()
|
|
602
|
+
|
|
603
|
+
def __applyNewLinesIfAny(self):
|
|
604
|
+
if self.__lines:
|
|
605
|
+
self.setLines(self.__lines)
|
|
606
|
+
self.__lines=[] # for refresh method to known when new lines added
|
|
547
607
|
|
|
548
608
|
def __create_basic_notification(self, persistent, close_on_click):
|
|
549
609
|
if BuildVersion.SDK_INT >= 26 and self.notification_manager.getNotificationChannel(self.channel_id) is None:
|
|
@@ -610,7 +670,9 @@ class Notification(BaseNotification):
|
|
|
610
670
|
self.__builder.setSmallIcon(icon)
|
|
611
671
|
else:
|
|
612
672
|
if self.logs:
|
|
613
|
-
|
|
673
|
+
app_folder=os.path.join(app_storage_path(),'app')
|
|
674
|
+
img_absolute_path = os.path.join(app_folder, img_path)
|
|
675
|
+
print(f'Failed getting img for custom notification icon defaulting to app icon\n absolute path {img_absolute_path}')
|
|
614
676
|
self.__builder.setSmallIcon(context.getApplicationInfo().icon)
|
|
615
677
|
|
|
616
678
|
@staticmethod
|
|
@@ -618,9 +680,13 @@ class Notification(BaseNotification):
|
|
|
618
680
|
app_folder=os.path.join(app_storage_path(),'app')
|
|
619
681
|
output_path = os.path.join(app_folder, relative_path)
|
|
620
682
|
if not os.path.exists(output_path):
|
|
621
|
-
print(f"\nImage not found at path: {
|
|
622
|
-
|
|
623
|
-
|
|
683
|
+
print(f"\nImage not found at path: {app_folder}, (Local images gotten from App Path)")
|
|
684
|
+
try:
|
|
685
|
+
print("- These are the existing files in your app Folder:")
|
|
686
|
+
print('['+', '.join(os.listdir(app_folder)) + ']')
|
|
687
|
+
except Exception as could_not_get_files_in_path_error:
|
|
688
|
+
print('Exception: ', could_not_get_files_in_path_error)
|
|
689
|
+
print("Couldn't get Files in App Folder")
|
|
624
690
|
return None
|
|
625
691
|
# TODO test with a badly written Image and catch error
|
|
626
692
|
Uri = autoclass('android.net.Uri')
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: android-notify
|
|
3
|
-
Version: 1.59.
|
|
4
|
-
Summary: A Python package that simplifies creating Android notifications in Kivy apps.
|
|
5
|
-
Home-page: https://android-notify.vercel.app
|
|
6
|
-
Author: Fabian
|
|
7
|
-
Author-email: fector101@yahoo.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Project-URL: Documentation, https://android-notify.vercel.app/
|
|
10
|
-
Project-URL: Source, https://github.com/fector101/android-notify
|
|
11
|
-
Project-URL: Tracker, https://github.com/fector101/android-notify/issues
|
|
12
|
-
Project-URL: Funding, https://www.buymeacoffee.com/fector101
|
|
13
|
-
Keywords: android,notifications,kivy,mobile,post-notifications,pyjnius,android-notifications,kivy-notifications,python-android,mobile-development,push-notifications,mobile-app,kivy-application
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: Operating System :: Android
|
|
17
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
18
|
-
Classifier: Intended Audience :: Developers
|
|
19
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Requires-Python: >=3.6
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: kivy>=2.0.0
|
|
23
|
-
Requires-Dist: pyjnius>=1.4.2
|
|
24
|
-
Dynamic: author
|
|
25
|
-
Dynamic: author-email
|
|
26
|
-
Dynamic: classifier
|
|
27
|
-
Dynamic: description
|
|
28
|
-
Dynamic: description-content-type
|
|
29
|
-
Dynamic: home-page
|
|
30
|
-
Dynamic: keywords
|
|
31
|
-
Dynamic: license
|
|
32
|
-
Dynamic: project-url
|
|
33
|
-
Dynamic: requires-dist
|
|
34
|
-
Dynamic: requires-python
|
|
35
|
-
Dynamic: summary
|
|
36
|
-
|
|
37
|
-
<div align="center">
|
|
38
|
-
<br>
|
|
39
|
-
<h1> Android-Notify </h1>
|
|
40
|
-
<p><a href='https://android-notify.vercel.app'>Android Notify</a> is a Python library for effortlessly creating and managing Android notifications in Kivy apps.</p>
|
|
41
|
-
<p>Supports various styles and ensures seamless integration, customization and Pythonic APIs.</p>
|
|
42
|
-
<!-- <br> -->
|
|
43
|
-
<!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
|
|
44
|
-
</div>
|
|
45
|
-
<!-- Channel [CRUD]
|
|
46
|
-
The Android Notify package provides a simple yet comprehensive way to create and manage rich notifications on Android devices directly from your Python code. This library bridges the gap between Python and Android's notification system, giving you full control over notifications with a clean, Pythonic API. -->
|
|
47
|
-
|
|
48
|
-
## Features
|
|
49
|
-
|
|
50
|
-
- **Multiple Notification Styles**: Support for various notification styles including:
|
|
51
|
-
- Simple text notifications
|
|
52
|
-
- Progress bar notifications (determinate and indeterminate)
|
|
53
|
-
- Big text notifications
|
|
54
|
-
- Inbox-style notifications
|
|
55
|
-
- Large icon notifications
|
|
56
|
-
- Big picture notifications
|
|
57
|
-
- Combined image styles
|
|
58
|
-
|
|
59
|
-
- **Rich Functionality**:
|
|
60
|
-
- Add action buttons with custom callbacks
|
|
61
|
-
- Update notification content dynamically
|
|
62
|
-
- Manage progress bars with fine-grained control
|
|
63
|
-
- Custom notification Icon
|
|
64
|
-
- Custom notification channels for Android 8.0+ (Creating and Deleting)
|
|
65
|
-
- Silent notifications
|
|
66
|
-
- Persistent notifications
|
|
67
|
-
- Click handlers and callbacks
|
|
68
|
-
- Cancel Notifications
|
|
69
|
-
|
|
70
|
-
## Quick Start
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from android_notify import Notification
|
|
74
|
-
|
|
75
|
-
# Simple notification
|
|
76
|
-
Notification(
|
|
77
|
-
title="Hello",
|
|
78
|
-
message="This is a basic notification."
|
|
79
|
-
).send()
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**Sample Image:**
|
|
84
|
-

|
|
85
|
-
|
|
86
|
-
## Installation
|
|
87
|
-
|
|
88
|
-
In your **`buildozer.spec`** file, ensure you include the following:
|
|
89
|
-
|
|
90
|
-
```ini
|
|
91
|
-
# Add pyjnius so ensure it's packaged with the build
|
|
92
|
-
requirements = python3, kivy, pyjnius, android-notify
|
|
93
|
-
# Add permission for notifications
|
|
94
|
-
android.permissions = POST_NOTIFICATIONS
|
|
95
|
-
|
|
96
|
-
# Required dependencies (write exactly as shown, no quotation marks)
|
|
97
|
-
android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
|
|
98
|
-
android.enable_androidx = True
|
|
99
|
-
android.api = 35
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Can be installed via `pip` For testing purposes:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
pip install android_notify
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Documentation
|
|
109
|
-
|
|
110
|
-
For full documentation, examples, and advanced usage, API reference visit the
|
|
111
|
-
[documentation](https://android-notify.vercel.app)
|
|
112
|
-
|
|
113
|
-
## ☕ Support the Project
|
|
114
|
-
|
|
115
|
-
If 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.
|
|
116
|
-
|
|
117
|
-
<a href="https://www.buymeacoffee.com/fector101" target="_blank">
|
|
118
|
-
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
|
|
119
|
-
</a>
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: android-notify
|
|
3
|
+
Version: 1.59.4
|
|
4
|
+
Summary: A Python package that simplifies creating Android notifications in Kivy apps.
|
|
5
|
+
Home-page: https://android-notify.vercel.app
|
|
6
|
+
Author: Fabian
|
|
7
|
+
Author-email: fector101@yahoo.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://android-notify.vercel.app/
|
|
10
|
+
Project-URL: Source, https://github.com/fector101/android-notify
|
|
11
|
+
Project-URL: Tracker, https://github.com/fector101/android-notify/issues
|
|
12
|
+
Project-URL: Funding, https://www.buymeacoffee.com/fector101
|
|
13
|
+
Keywords: android,notifications,kivy,mobile,post-notifications,pyjnius,android-notifications,kivy-notifications,python-android,mobile-development,push-notifications,mobile-app,kivy-application
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: Android
|
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.6
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: kivy>=2.0.0
|
|
23
|
+
Requires-Dist: pyjnius>=1.4.2
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: author-email
|
|
26
|
+
Dynamic: classifier
|
|
27
|
+
Dynamic: description
|
|
28
|
+
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: keywords
|
|
31
|
+
Dynamic: license
|
|
32
|
+
Dynamic: project-url
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
<div align="center">
|
|
38
|
+
<br>
|
|
39
|
+
<h1> Android-Notify </h1>
|
|
40
|
+
<p><a href='https://android-notify.vercel.app'>Android Notify</a> is a Python library for effortlessly creating and managing Android notifications in Kivy apps.</p>
|
|
41
|
+
<p>Supports various styles and ensures seamless integration, customization and Pythonic APIs.</p>
|
|
42
|
+
<!-- <br> -->
|
|
43
|
+
<!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
|
|
44
|
+
</div>
|
|
45
|
+
<!-- Channel [CRUD]
|
|
46
|
+
The Android Notify package provides a simple yet comprehensive way to create and manage rich notifications on Android devices directly from your Python code. This library bridges the gap between Python and Android's notification system, giving you full control over notifications with a clean, Pythonic API. -->
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **Multiple Notification Styles**: Support for various notification styles including:
|
|
51
|
+
- Simple text notifications
|
|
52
|
+
- Progress bar notifications (determinate and indeterminate)
|
|
53
|
+
- Big text notifications
|
|
54
|
+
- Inbox-style notifications
|
|
55
|
+
- Large icon notifications
|
|
56
|
+
- Big picture notifications
|
|
57
|
+
- Combined image styles
|
|
58
|
+
|
|
59
|
+
- **Rich Functionality**:
|
|
60
|
+
- Add action buttons with custom callbacks
|
|
61
|
+
- Update notification content dynamically
|
|
62
|
+
- Manage progress bars with fine-grained control
|
|
63
|
+
- Custom notification Icon
|
|
64
|
+
- Custom notification channels for Android 8.0+ (Creating and Deleting)
|
|
65
|
+
- Silent notifications
|
|
66
|
+
- Persistent notifications
|
|
67
|
+
- Click handlers and callbacks
|
|
68
|
+
- Cancel Notifications
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from android_notify import Notification
|
|
74
|
+
|
|
75
|
+
# Simple notification
|
|
76
|
+
Notification(
|
|
77
|
+
title="Hello",
|
|
78
|
+
message="This is a basic notification."
|
|
79
|
+
).send()
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Sample Image:**
|
|
84
|
+

|
|
85
|
+
|
|
86
|
+
## Installation
|
|
87
|
+
|
|
88
|
+
In your **`buildozer.spec`** file, ensure you include the following:
|
|
89
|
+
|
|
90
|
+
```ini
|
|
91
|
+
# Add pyjnius so ensure it's packaged with the build
|
|
92
|
+
requirements = python3, kivy, pyjnius, android-notify
|
|
93
|
+
# Add permission for notifications
|
|
94
|
+
android.permissions = POST_NOTIFICATIONS
|
|
95
|
+
|
|
96
|
+
# Required dependencies (write exactly as shown, no quotation marks)
|
|
97
|
+
android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
|
|
98
|
+
android.enable_androidx = True
|
|
99
|
+
android.api = 35
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Can be installed via `pip` For testing purposes:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install android_notify
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Documentation
|
|
109
|
+
|
|
110
|
+
For full documentation, examples, and advanced usage, API reference visit the
|
|
111
|
+
[documentation](https://android-notify.vercel.app)
|
|
112
|
+
|
|
113
|
+
## ☕ Support the Project
|
|
114
|
+
|
|
115
|
+
If 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.
|
|
116
|
+
|
|
117
|
+
<a href="https://www.buymeacoffee.com/fector101" target="_blank">
|
|
118
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
|
|
119
|
+
</a>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as readme_data:
|
|
|
6
6
|
|
|
7
7
|
setup(
|
|
8
8
|
name="android-notify",
|
|
9
|
-
version="1.59.
|
|
9
|
+
version="1.59.4",
|
|
10
10
|
author="Fabian",
|
|
11
11
|
author_email='fector101@yahoo.com',
|
|
12
12
|
description="A Python package that simplifies creating Android notifications in Kivy apps.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_notify-1.59.2 → android_notify-1.59.4}/android_notify.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|