android-notify 1.57.1__py3-none-any.whl → 1.59__py3-none-any.whl
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.
- android_notify/{types_idea.py → an_types.py} +20 -1
- android_notify/base.py +10 -3
- android_notify/sword.py +462 -214
- android_notify-1.59.dist-info/METADATA +117 -0
- android_notify-1.59.dist-info/RECORD +11 -0
- {android_notify-1.57.1.dist-info → android_notify-1.59.dist-info}/WHEEL +1 -1
- android_notify-1.57.1.dist-info/METADATA +0 -575
- android_notify-1.57.1.dist-info/RECORD +0 -11
- {android_notify-1.57.1.dist-info → android_notify-1.59.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
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://github.com/fector101/android-notify
|
|
6
|
+
Author: Fabian
|
|
7
|
+
Author-email: fector101@yahoo.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://android-notify.vercel.app/getting-started
|
|
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-Notifiy </h1>
|
|
40
|
+
<p><a href='https://android-notify.vercel.app/getting-started'>Android Notify</a> is a Python library for effortlessly creating and managing Android notifications in Kivy android 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
|
+
<!--
|
|
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 channels for Android 8.0+
|
|
64
|
+
- Silent notifications
|
|
65
|
+
- Persistent notifications
|
|
66
|
+
- Click handlers and callbacks
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from android_notify import Notification
|
|
72
|
+
|
|
73
|
+
# Simple notification
|
|
74
|
+
Notification(
|
|
75
|
+
title="Hello",
|
|
76
|
+
message="This is a basic notification."
|
|
77
|
+
).send()
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Sample Image:**
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
## Installation
|
|
85
|
+
|
|
86
|
+
In your **`buildozer.spec`** file, ensure you include the following:
|
|
87
|
+
|
|
88
|
+
```ini
|
|
89
|
+
# Add pyjnius so ensure it's packaged with the build
|
|
90
|
+
requirements = python3, kivy, pyjnius, android-notify
|
|
91
|
+
# Add permission for notifications
|
|
92
|
+
android.permissions = POST_NOTIFICATIONS
|
|
93
|
+
|
|
94
|
+
# Required dependencies (write exactly as shown, no quotation marks)
|
|
95
|
+
android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
|
|
96
|
+
android.enable_androidx = True
|
|
97
|
+
android.api = 35
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Can be installed via `pip` For testing purposes:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install android_notify
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Documentation
|
|
107
|
+
|
|
108
|
+
For full documentation, examples, and advanced usage, API reference visit the
|
|
109
|
+
[documentation](https://android-notify.vercel.app/getting-started)
|
|
110
|
+
|
|
111
|
+
## ☕ Support the Project
|
|
112
|
+
|
|
113
|
+
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.
|
|
114
|
+
|
|
115
|
+
<a href="https://www.buymeacoffee.com/fector101" target="_blank">
|
|
116
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
|
|
117
|
+
</a>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
android_notify/__init__.py,sha256=lcLjyfegXgU7cyGhfSphAOBipXwemrVkdYy3mcF6X5Y,172
|
|
2
|
+
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
android_notify/an_types.py,sha256=LlE0zzPskVG2topZx3mVETGu5MqnpThs58Ph392ocy4,2390
|
|
4
|
+
android_notify/base.py,sha256=Fgv3hf-vwu-GvivDsKxseOyeOrLmw1moNAv_mZKvA5M,3477
|
|
5
|
+
android_notify/core.py,sha256=Per4HFwYwP-mxHJqnwcLlWXsbZsSeeAYN49MmFU2qVk,6113
|
|
6
|
+
android_notify/styles.py,sha256=QBkCY8ZO26FnS-jPtRLf9CKEEnnYylmH9enCa5CNDes,354
|
|
7
|
+
android_notify/sword.py,sha256=hBNIJDDszEozbvkXHuWhmiRz-9q2Kz4WBEnV1LAe8vw,37291
|
|
8
|
+
android_notify-1.59.dist-info/METADATA,sha256=U4RSxaMqEaWBoS82Kp5L66992cka8MixFGwYlqYQiHM,4347
|
|
9
|
+
android_notify-1.59.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
|
10
|
+
android_notify-1.59.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
11
|
+
android_notify-1.59.dist-info/RECORD,,
|
|
@@ -1,575 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: android-notify
|
|
3
|
-
Version: 1.57.1
|
|
4
|
-
Summary: A Python package that simpilfies creating Android notifications in Kivy apps.
|
|
5
|
-
Home-page: https://github.com/fector101/android-notify
|
|
6
|
-
Author: Fabian
|
|
7
|
-
Author-email: fector101@yahoo.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Project-URL: Documentation, https://github.com/fector101/android-notify/
|
|
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-Notifiy </h1>
|
|
40
|
-
<p> A Python library for effortlessly creating and managing Android notifications in Kivy android apps.</p>
|
|
41
|
-
<p>Supports various styles and ensures seamless integration and customization.</p>
|
|
42
|
-
<!-- <br> -->
|
|
43
|
-
<!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
## Features
|
|
47
|
-
|
|
48
|
-
- Also Compatible with Android 8.0+.
|
|
49
|
-
- Supports including images in notifications.
|
|
50
|
-
- All Notifications can take Functions (version 1.50+) [functions section](#functions).
|
|
51
|
-
- Advanced Notification Handling [section](#advanced-features).
|
|
52
|
-
- Changing default app notification icon with PNG,
|
|
53
|
-
- Support for multiple notification styles:
|
|
54
|
-
- [Simple](#basic-usage)
|
|
55
|
-
- [Progress](#progress-bar-notification)
|
|
56
|
-
- [Big Picture](#notification-with-an-image-big-picture-style)
|
|
57
|
-
- [Inbox](#inbox-notification-style)
|
|
58
|
-
- [Large Icon](#notification-with-an-image-large-icon-style)
|
|
59
|
-
- [Buttons](#notification-with-buttons)
|
|
60
|
-
- [Big Text](#big-text-notification)
|
|
61
|
-
|
|
62
|
-
- persistenting notification [section](#methods)
|
|
63
|
-
|
|
64
|
-
This module automatically handles:
|
|
65
|
-
|
|
66
|
-
- Permission requests for notifications
|
|
67
|
-
- Customizable notification channels.
|
|
68
|
-
- Opening app on notification click
|
|
69
|
-
|
|
70
|
-
## Installation
|
|
71
|
-
|
|
72
|
-
This package is available on PyPI and can be installed via pip:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
pip install android-notify
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## **Dependencies**
|
|
79
|
-
|
|
80
|
-
**Prerequisites:**
|
|
81
|
-
|
|
82
|
-
- Kivy
|
|
83
|
-
|
|
84
|
-
In your **`buildozer.spec`** file, ensure you include the following:
|
|
85
|
-
|
|
86
|
-
```ini
|
|
87
|
-
# Add pyjnius so ensure it's packaged with the build
|
|
88
|
-
requirements = python3, kivy, pyjnius, android-notify
|
|
89
|
-
|
|
90
|
-
# Add permission for notifications
|
|
91
|
-
android.permissions = POST_NOTIFICATIONS
|
|
92
|
-
|
|
93
|
-
# Required dependencies (write exactly as shown, no quotation marks)
|
|
94
|
-
android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
|
|
95
|
-
android.enable_androidx = True
|
|
96
|
-
android.api = 35
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## Basic Usage
|
|
102
|
-
|
|
103
|
-
```python
|
|
104
|
-
from android_notify import Notification
|
|
105
|
-
|
|
106
|
-
# Create a simple notification
|
|
107
|
-
notification = Notification(
|
|
108
|
-
title="Hello",
|
|
109
|
-
message="This is a basic notification."
|
|
110
|
-
)
|
|
111
|
-
notification.send()
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**Sample Image:**
|
|
115
|
-

|
|
116
|
-
|
|
117
|
-
## Notification Styles
|
|
118
|
-
|
|
119
|
-
The library supports multiple notification styles:
|
|
120
|
-
|
|
121
|
-
1. `simple` - Basic notification with title and message
|
|
122
|
-
2. `progress` - Shows a progress bar
|
|
123
|
-
3. `big_picture` - Notification with a large image
|
|
124
|
-
4. `large_icon` - Notification with a custom icon
|
|
125
|
-
5. `both_imgs` - Combines big picture and large icon
|
|
126
|
-
6. `inbox` - List-style notification
|
|
127
|
-
7. `big_text` - Expandable notification with long text
|
|
128
|
-
8. `custom` - For custom notification styles
|
|
129
|
-
|
|
130
|
-
### Style Examples
|
|
131
|
-
|
|
132
|
-
#### Progress Bar notification
|
|
133
|
-
|
|
134
|
-
```python
|
|
135
|
-
from kivy.clock import Clock
|
|
136
|
-
|
|
137
|
-
progress = 0
|
|
138
|
-
|
|
139
|
-
notification = Notification(
|
|
140
|
-
title="Downloading...", message="0% downloaded",
|
|
141
|
-
style= "progress",
|
|
142
|
-
progress_current_value=0,progress_max_value=100
|
|
143
|
-
)
|
|
144
|
-
notification.send()
|
|
145
|
-
|
|
146
|
-
def update_progress(dt):
|
|
147
|
-
global progress
|
|
148
|
-
progress = min(progress + 10, 100)
|
|
149
|
-
notification.updateProgressBar(progress, f"{progress}% downloaded")
|
|
150
|
-
return progress < 100 # Stops when reaching 100%
|
|
151
|
-
|
|
152
|
-
Clock.schedule_interval(update_progress, 3)
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
**Sample Image:**
|
|
156
|
-

|
|
157
|
-
|
|
158
|
-
#### Images
|
|
159
|
-
|
|
160
|
-
##### Notification with an Image (Big Picture Style)
|
|
161
|
-
|
|
162
|
-
> [!NOTE]
|
|
163
|
-
> Online Images should start with `http://` or `https://`
|
|
164
|
-
> And request for permission, `android.permissions = INTERNET`
|
|
165
|
-
> No additionally permissions needed for images in App folder
|
|
166
|
-
|
|
167
|
-
```python
|
|
168
|
-
# Image notification
|
|
169
|
-
notification = Notification(
|
|
170
|
-
title='Picture Alert!',
|
|
171
|
-
message='This notification includes an image.',
|
|
172
|
-
style="big_picture",
|
|
173
|
-
big_picture_path="assets/imgs/photo.png"
|
|
174
|
-
)
|
|
175
|
-
notification.send()
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
**Sample Image:**
|
|
180
|
-

|
|
181
|
-
|
|
182
|
-
##### Notification with an Image (Large Icon Style)
|
|
183
|
-
|
|
184
|
-
```python
|
|
185
|
-
notification = Notification(
|
|
186
|
-
title="FabianDev_",
|
|
187
|
-
message="A twitter about some programming stuff",
|
|
188
|
-
style="large_icon",
|
|
189
|
-
large_icon_path="assets/imgs/profile.png"
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**Sample Image:**
|
|
195
|
-

|
|
196
|
-
|
|
197
|
-
#### Inbox Notification Style
|
|
198
|
-
|
|
199
|
-
```python
|
|
200
|
-
# Send a notification with inbox style
|
|
201
|
-
notification = Notification(
|
|
202
|
-
title='Inbox Notification',
|
|
203
|
-
message='Line 1\nLine 2\nLine 3',
|
|
204
|
-
style='inbox'
|
|
205
|
-
)
|
|
206
|
-
notification.send()
|
|
207
|
-
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
**Sample Image:**
|
|
211
|
-

|
|
212
|
-
|
|
213
|
-
#### Notification with Buttons
|
|
214
|
-
|
|
215
|
-
Here's a sample of how to add buttons below, To Remove Buttons Simply Call the `removeButtons` method on the Notification Instance
|
|
216
|
-
|
|
217
|
-
```python
|
|
218
|
-
notification = Notification(title="Jane Dough", message="How to use android-notify #coding #purepython")
|
|
219
|
-
def playVideo():
|
|
220
|
-
print('Playing Video')
|
|
221
|
-
|
|
222
|
-
def turnOffNoti():
|
|
223
|
-
print('Please Turn OFf Noti')
|
|
224
|
-
|
|
225
|
-
def watchLater():
|
|
226
|
-
print('Add to Watch Later')
|
|
227
|
-
|
|
228
|
-
notification.addButton(text="Play",on_release=playVideo)
|
|
229
|
-
notification.addButton(text="Turn Off",on_release=turnOffNoti)
|
|
230
|
-
notification.addButton(text="Watch Later",on_release=watchLater)
|
|
231
|
-
notification.send()
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
**Sample Image:**
|
|
235
|
-

|
|
236
|
-
|
|
237
|
-
#### Big text notification
|
|
238
|
-
|
|
239
|
-
When using `big_text` style `message` acts as sub-title, Then when notification drop down button is pressed `body` is revealed
|
|
240
|
-
|
|
241
|
-
```python
|
|
242
|
-
notification = Notification(
|
|
243
|
-
title="Article",
|
|
244
|
-
message="Histroy of Loerm Ipsuim",
|
|
245
|
-
body="Lorem Ipsum is simply dummy text of the printing and ...",
|
|
246
|
-
style="big_text"
|
|
247
|
-
)
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-

|
|
251
|
-
|
|
252
|
-
## Advanced Features
|
|
253
|
-
|
|
254
|
-
### Updating Notifications
|
|
255
|
-
|
|
256
|
-
```python
|
|
257
|
-
notification = Notification(title="Initial Title")
|
|
258
|
-
notification.send()
|
|
259
|
-
|
|
260
|
-
# Update title
|
|
261
|
-
notification.updateTitle("New Title")
|
|
262
|
-
|
|
263
|
-
# Update message
|
|
264
|
-
notification.updateMessage("New Message")
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### Progress Bar Management
|
|
268
|
-
|
|
269
|
-
```python
|
|
270
|
-
notification = Notification(
|
|
271
|
-
title="Download..",
|
|
272
|
-
style="progress"
|
|
273
|
-
)
|
|
274
|
-
# send notification
|
|
275
|
-
notification.send()
|
|
276
|
-
|
|
277
|
-
# Update progress
|
|
278
|
-
notification.updateProgressBar(30, "30% downloaded")
|
|
279
|
-
|
|
280
|
-
# Remove progress bar
|
|
281
|
-
# show_on_update to notification briefly after removed progressbar
|
|
282
|
-
notification.removeProgressBar("Download Complete",show_on_update=True)
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Adding Style even when already sent
|
|
286
|
-
|
|
287
|
-
This is how you add a new style to notification, If already sent or not
|
|
288
|
-
|
|
289
|
-
```python
|
|
290
|
-
from android_notify import NotificationStyles
|
|
291
|
-
|
|
292
|
-
notification = Notification(
|
|
293
|
-
title="Download..",
|
|
294
|
-
style="progress"
|
|
295
|
-
)
|
|
296
|
-
notification.send()
|
|
297
|
-
|
|
298
|
-
notification.updateTitle("Download Completed")
|
|
299
|
-
notification.removeProgressBar()
|
|
300
|
-
|
|
301
|
-
# Add New Style
|
|
302
|
-
notification.large_icon_path="users/imgs/profile1234.png"
|
|
303
|
-
notification.addNotificationStyle(NotificationStyles.LARGE_ICON,already_sent=True)
|
|
304
|
-
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Channel Management
|
|
308
|
-
|
|
309
|
-
Notifications are organized into channels. You can customize the channel name and ID:
|
|
310
|
-
|
|
311
|
-
- Custom Channel Name's Gives User ability to turn on/off specific notifications
|
|
312
|
-
|
|
313
|
-
```python
|
|
314
|
-
notification = Notification(
|
|
315
|
-
title="Download finished",
|
|
316
|
-
message="How to Catch a Fish.mp4",
|
|
317
|
-
channel_name="Download Notifications", # Will create User-visible name "Download Notifications"
|
|
318
|
-
channel_id="downloads_notifications" # Optional: specify custom channel ID
|
|
319
|
-
)
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
**Sample Image:**
|
|
323
|
-

|
|
324
|
-
|
|
325
|
-
### Silent Notifications
|
|
326
|
-
|
|
327
|
-
To send a notification without sound or heads-up display:
|
|
328
|
-
|
|
329
|
-
```python
|
|
330
|
-
notification = Notification(title="Silent Update")
|
|
331
|
-
notification.send(silent=True)
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
## Functions
|
|
335
|
-
|
|
336
|
-
```python
|
|
337
|
-
from kivymd.app import MDApp
|
|
338
|
-
from android_notify import Notification
|
|
339
|
-
|
|
340
|
-
class Myapp(MDApp):
|
|
341
|
-
|
|
342
|
-
def on_start(self):
|
|
343
|
-
Notification(title="Hello", message="This is a basic notification.",callback=self.doSomething).send()
|
|
344
|
-
|
|
345
|
-
def doSomething(self):
|
|
346
|
-
print("print in Debug Console")
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### Get Which Notification was used to Open App - identifer (str)
|
|
350
|
-
|
|
351
|
-
If you just want to get the Exact Notification Clicked to Open App, you can use NotificationHandler to get unique identifer
|
|
352
|
-
|
|
353
|
-
```python
|
|
354
|
-
from kivymd.app import MDApp
|
|
355
|
-
from android_notify import Notification, NotificationHandler
|
|
356
|
-
|
|
357
|
-
class Myapp(MDApp):
|
|
358
|
-
|
|
359
|
-
def on_start(self):
|
|
360
|
-
|
|
361
|
-
notify = Notification(title="Change Page", message="Click to change App page.", identifer='change_app_page')
|
|
362
|
-
notify.send()
|
|
363
|
-
|
|
364
|
-
notify1 = Notification(title="Change Colour", message="Click to change App Colour", identifer='change_app_color')
|
|
365
|
-
notify1.send()
|
|
366
|
-
|
|
367
|
-
def on_resume(self):
|
|
368
|
-
# Is called everytime app is reopened
|
|
369
|
-
notify_identifer = NotificationHandler.getIdentifer()
|
|
370
|
-
if notify_identifer == 'change_app_page':
|
|
371
|
-
# Code to change Screen
|
|
372
|
-
pass
|
|
373
|
-
elif notify_identifer == 'change_app_color':
|
|
374
|
-
# Code to change Screen Color
|
|
375
|
-
pass
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
### Assist
|
|
379
|
-
|
|
380
|
-
- Avoiding Human Error when using different notification styles
|
|
381
|
-
|
|
382
|
-
```python
|
|
383
|
-
from android_notify import Notification, NotificationStyles
|
|
384
|
-
Notification(
|
|
385
|
-
title="New Photo",
|
|
386
|
-
message="Check out this image",
|
|
387
|
-
style=NotificationStyles.BIG_PICTURE,
|
|
388
|
-
big_picture_path="assets/imgs/photo.png"
|
|
389
|
-
).send()
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
#### To Use New Version Of Android-Notify
|
|
393
|
-
|
|
394
|
-
To be safe Delete All Old Versions of Android-Notify from `.buildozer` directory
|
|
395
|
-
|
|
396
|
-
##### On Linux run
|
|
397
|
-
|
|
398
|
-
`cd .buildozer && find . -type d -name "android_notify*" -print0 | xargs -0 rm -r && cd ..`
|
|
399
|
-
|
|
400
|
-
##### On Windows (PowerShell) run
|
|
401
|
-
|
|
402
|
-
- If command prints right folder paths Replace `Write-Output` with `Remove-Item`
|
|
403
|
-
|
|
404
|
-
```sh
|
|
405
|
-
cd .buildozer
|
|
406
|
-
Get-ChildItem -Path . -Directory -Filter "android_notify*" | ForEach-Object { Write-Output $_.FullName }
|
|
407
|
-
cd ..
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
##### On Windows Git Bash (if installed)
|
|
411
|
-
|
|
412
|
-
`cd .buildozer && find . -type d -name "android_notify*" -print0 | xargs -0 rm -r && cd ..`
|
|
413
|
-
|
|
414
|
-
##### On macOS run
|
|
415
|
-
|
|
416
|
-
`cd .buildozer && find . -type d -name "android_notify*" -exec rm -r {} + && cd ..`
|
|
417
|
-
|
|
418
|
-
### Development Mode
|
|
419
|
-
|
|
420
|
-
#### For Logs
|
|
421
|
-
|
|
422
|
-
When developing on non-Android platforms, the library provides debugging output:
|
|
423
|
-
|
|
424
|
-
```python
|
|
425
|
-
# Enable logs (default is True when not on Android)
|
|
426
|
-
Notification.logs = True
|
|
427
|
-
|
|
428
|
-
# Create notification for testing
|
|
429
|
-
notification = Notification(title="Test")
|
|
430
|
-
notification.send()
|
|
431
|
-
# Will print notification properties instead of sending
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
### Methods
|
|
435
|
-
|
|
436
|
-
### Instance.**init**
|
|
437
|
-
|
|
438
|
-
args
|
|
439
|
-
|
|
440
|
-
- 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
|
|
441
|
-
|
|
442
|
-
### Instance.send
|
|
443
|
-
|
|
444
|
-
args
|
|
445
|
-
|
|
446
|
-
- persistent : To make notification stay after user clicks clear All
|
|
447
|
-
- close_on_click : To close notification on click
|
|
448
|
-
|
|
449
|
-
### Instance.addButton
|
|
450
|
-
|
|
451
|
-
args
|
|
452
|
-
|
|
453
|
-
- text : Button Text
|
|
454
|
-
|
|
455
|
-
### Instance.updateTitle
|
|
456
|
-
|
|
457
|
-
args
|
|
458
|
-
|
|
459
|
-
- new_title : String to be set as New notification Title
|
|
460
|
-
|
|
461
|
-
### Instance.updateMessage
|
|
462
|
-
|
|
463
|
-
args
|
|
464
|
-
|
|
465
|
-
- new_message : String to be set as New notification Message
|
|
466
|
-
|
|
467
|
-
### Instance.showInfiniteProgressBar
|
|
468
|
-
|
|
469
|
-
Displays an Infinite Progress Bar in Notification, Can be Removed using `removeProgressBar` and updated using `updateProgressBar` method
|
|
470
|
-
|
|
471
|
-
### Instance.updateProgressBar
|
|
472
|
-
|
|
473
|
-
if updating title,msg with progressbar frequenlty pass them in too to avoid update issues.
|
|
474
|
-
According to android docs updates shouldn't be too frequent.
|
|
475
|
-
|
|
476
|
-
`updateProgressBar` has a built-in delay of 0.5 secs
|
|
477
|
-
|
|
478
|
-
args
|
|
479
|
-
|
|
480
|
-
- current_value (str): the value from progressbar current progress
|
|
481
|
-
- message (str,optional): defaults to last message
|
|
482
|
-
- title (str,optional): defaults to last title
|
|
483
|
-
|
|
484
|
-
### Instance.removeProgressBar
|
|
485
|
-
|
|
486
|
-
This Removes Progress bar
|
|
487
|
-
|
|
488
|
-
args
|
|
489
|
-
|
|
490
|
-
- message (str, optional): notification message, Defaults to 'last message'.
|
|
491
|
-
- show_on_update (bool, optional): To show notification brifely when progressbar removed. Defaults to True.
|
|
492
|
-
- title (str, optional): notification title, Defaults to 'last title'.
|
|
493
|
-
|
|
494
|
-
### Instance.addNotificationStyle
|
|
495
|
-
|
|
496
|
-
This is useful to add style after Notification is sent or Add more styles to Notification
|
|
497
|
-
args
|
|
498
|
-
|
|
499
|
-
- style: choosen style. All options are in the `NotificationStyles` class `['simple','progress','inbox','big_text','large_icon','big_picture','both_imgs]`
|
|
500
|
-
- already_sent: specfiy if notification.send() method has already been called, it defaults to false
|
|
501
|
-
|
|
502
|
-
## Image Requirements
|
|
503
|
-
|
|
504
|
-
- Online Images should start with `http://` or `https://`
|
|
505
|
-
- Local Images must be located within your app's folder
|
|
506
|
-
|
|
507
|
-
## Error Handling
|
|
508
|
-
|
|
509
|
-
The library validates arguments and provides helpful error messages:
|
|
510
|
-
|
|
511
|
-
- Invalid style names will suggest the closest matching style
|
|
512
|
-
- Invalid arguments will list all valid options
|
|
513
|
-
- Missing image files will list all files in App Directory
|
|
514
|
-
|
|
515
|
-
## Limitation
|
|
516
|
-
|
|
517
|
-
1. Only works on Android devices
|
|
518
|
-
|
|
519
|
-
## Best Practices
|
|
520
|
-
|
|
521
|
-
1. Always handle permissions appropriately
|
|
522
|
-
2. use `NotificationStyles` to set `style`, use `style=NotificationStyles.LARGE_ICON` instead of `style="large_icon"`
|
|
523
|
-
3. Use meaningful channel names for organization
|
|
524
|
-
4. Keep progress bar updates reasonable (don't update too frequently)
|
|
525
|
-
5. Test notifications on different Android versions
|
|
526
|
-
6. Consider using silent notifications for frequent updates
|
|
527
|
-
|
|
528
|
-
## Debugging Tips
|
|
529
|
-
|
|
530
|
-
1. Enable logs during development: `Notification.logs = True`
|
|
531
|
-
2. Check channel creation with Android's notification settings
|
|
532
|
-
3. Verify image paths before sending notifications
|
|
533
|
-
4. Test different styles to ensure proper display
|
|
534
|
-
|
|
535
|
-
Remember to check Android's notification documentation for best practices and guidelines regarding notification frequency and content.
|
|
536
|
-
|
|
537
|
-
## Contribution
|
|
538
|
-
|
|
539
|
-
Feel free to open issues or submit pull requests for improvements!
|
|
540
|
-
|
|
541
|
-
## Reporting Issues
|
|
542
|
-
|
|
543
|
-
Found a bug? Please open an issue on our [GitHub Issues](https://github.com/Fector101/android_notify/issues) page.
|
|
544
|
-
|
|
545
|
-
## Author
|
|
546
|
-
|
|
547
|
-
- Fabian - <fector101@yahoo.com>
|
|
548
|
-
- GitHub: [Android Notify Repo](https://github.com/Fector101/android_notify)
|
|
549
|
-
- Twitter: [FabianDev_](https://twitter.com/intent/user?user_id=1246911115319263233)
|
|
550
|
-
|
|
551
|
-
For feedback or contributions, feel free to reach out!
|
|
552
|
-
|
|
553
|
-
---
|
|
554
|
-
|
|
555
|
-
## ☕ Support the Project
|
|
556
|
-
|
|
557
|
-
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.
|
|
558
|
-
|
|
559
|
-
<a href="https://www.buymeacoffee.com/fector101" target="_blank">
|
|
560
|
-
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
|
|
561
|
-
</a>
|
|
562
|
-
|
|
563
|
-
---
|
|
564
|
-
|
|
565
|
-
## Acknowledgments
|
|
566
|
-
|
|
567
|
-
- 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.
|
|
568
|
-
- Thanks to the Kivy and Pyjnius communities.
|
|
569
|
-
|
|
570
|
-
---
|
|
571
|
-
|
|
572
|
-
## 🌐 **Links**
|
|
573
|
-
|
|
574
|
-
- **PyPI:** [android-notify on PyPI](https://pypi.org/project/android-notify/)
|
|
575
|
-
- **GitHub:** [Source Code Repository](https://github.com/Fector101/android_notify/)
|