android-notify 1.2__py3-none-any.whl → 1.21__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.
Potentially problematic release.
This version of android-notify might be problematic. Click here for more details.
- android_notify/__init__.py +2 -0
- android_notify/core.py +3 -6
- {android_notify-1.2.dist-info → android_notify-1.21.dist-info}/METADATA +47 -6
- android_notify-1.21.dist-info/RECORD +8 -0
- android_notify-1.2.dist-info/RECORD +0 -8
- {android_notify-1.2.dist-info → android_notify-1.21.dist-info}/WHEEL +0 -0
- {android_notify-1.2.dist-info → android_notify-1.21.dist-info}/top_level.txt +0 -0
android_notify/__init__.py
CHANGED
android_notify/core.py
CHANGED
|
@@ -20,7 +20,7 @@ except Exception as e:
|
|
|
20
20
|
|
|
21
21
|
if ON_ANDROID:
|
|
22
22
|
try:
|
|
23
|
-
|
|
23
|
+
NotificationManagerCompat = autoclass('androidx.core.app.NotificationManagerCompat')
|
|
24
24
|
NotificationCompat = autoclass('androidx.core.app.NotificationCompat')
|
|
25
25
|
|
|
26
26
|
# Notification Design
|
|
@@ -82,8 +82,8 @@ def send_notification(title:str, message:str, style=None, img_path=None, channel
|
|
|
82
82
|
# Get notification manager
|
|
83
83
|
notification_manager = context.getSystemService(context.NOTIFICATION_SERVICE)
|
|
84
84
|
|
|
85
|
-
importance= autoclass('android.app.NotificationManager').IMPORTANCE_HIGH # also works #NotificationManager.IMPORTANCE_DEFAULT
|
|
86
|
-
|
|
85
|
+
# importance= autoclass('android.app.NotificationManager').IMPORTANCE_HIGH # also works #NotificationManager.IMPORTANCE_DEFAULT
|
|
86
|
+
importance= NotificationManagerCompat.IMPORTANCE_HIGH #autoclass('android.app.NotificationManager').IMPORTANCE_HIGH also works #NotificationManager.IMPORTANCE_DEFAULT
|
|
87
87
|
|
|
88
88
|
# Notification Channel (Required for Android 8.0+)
|
|
89
89
|
if BuildVersion.SDK_INT >= 26:
|
|
@@ -98,7 +98,6 @@ def send_notification(title:str, message:str, style=None, img_path=None, channel
|
|
|
98
98
|
builder.setDefaults(NotificationCompat.DEFAULT_ALL)
|
|
99
99
|
builder.setPriority(NotificationCompat.PRIORITY_HIGH)
|
|
100
100
|
|
|
101
|
-
# Get Image
|
|
102
101
|
img=None
|
|
103
102
|
if img_path:
|
|
104
103
|
try:
|
|
@@ -112,8 +111,6 @@ def send_notification(title:str, message:str, style=None, img_path=None, channel
|
|
|
112
111
|
big_text_style = NotificationCompatBigTextStyle()
|
|
113
112
|
big_text_style.bigText(message)
|
|
114
113
|
builder.setStyle(big_text_style)
|
|
115
|
-
|
|
116
|
-
|
|
117
114
|
elif style == "big_picture" and img_path:
|
|
118
115
|
bitmap = BitmapFactory.decodeStream(context.getContentResolver().openInputStream(img))
|
|
119
116
|
builder.setLargeIcon(bitmap)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: android_notify
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.21
|
|
4
4
|
Summary: A Python package for sending Android notifications.
|
|
5
5
|
Home-page: https://github.com/Fector101/android_notify/
|
|
6
6
|
Author: Fabian
|
|
@@ -60,12 +60,21 @@ android.enable_androidx = True
|
|
|
60
60
|
|
|
61
61
|
### Example Notification
|
|
62
62
|
|
|
63
|
+
#### Basic Notification
|
|
64
|
+
|
|
63
65
|
```python
|
|
64
|
-
from android_notify
|
|
66
|
+
from android_notify import send_notification
|
|
65
67
|
|
|
66
68
|
# Send a basic notification
|
|
67
69
|
send_notification("Hello", "This is a basic notification.")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Example Image:**
|
|
73
|
+

|
|
68
74
|
|
|
75
|
+
#### Notification with an Image (Big Picture Style)
|
|
76
|
+
|
|
77
|
+
```python
|
|
69
78
|
# Send a notification with an image
|
|
70
79
|
send_notification(
|
|
71
80
|
title='Picture Alert!',
|
|
@@ -73,15 +82,29 @@ send_notification(
|
|
|
73
82
|
style='big_picture',
|
|
74
83
|
img_path='assets/imgs/icon.png'
|
|
75
84
|
)
|
|
85
|
+
```
|
|
76
86
|
|
|
87
|
+
**Example Image:**
|
|
88
|
+

|
|
89
|
+
|
|
90
|
+
#### Inbox Notification Style
|
|
91
|
+
|
|
92
|
+
```python
|
|
77
93
|
# Send a notification with inbox style
|
|
78
94
|
send_notification(
|
|
79
95
|
title='Inbox Notification',
|
|
80
96
|
message='Line 1\nLine 2\nLine 3',
|
|
81
97
|
style='inbox'
|
|
82
98
|
)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Example Image:**
|
|
102
|
+

|
|
103
|
+
|
|
104
|
+
#### Big Text Notification
|
|
83
105
|
|
|
84
|
-
|
|
106
|
+
```python
|
|
107
|
+
# Send a Big Text notification
|
|
85
108
|
send_notification(
|
|
86
109
|
title='Hello!',
|
|
87
110
|
message='This is a sample notification.',
|
|
@@ -89,12 +112,17 @@ send_notification(
|
|
|
89
112
|
)
|
|
90
113
|
```
|
|
91
114
|
|
|
115
|
+
**Example Image:**
|
|
116
|
+

|
|
117
|
+
|
|
92
118
|
---
|
|
93
119
|
|
|
94
|
-
### **Assist**
|
|
120
|
+
### **Assist**
|
|
121
|
+
|
|
122
|
+
- How to Copy image to app folder
|
|
95
123
|
|
|
96
124
|
```python
|
|
97
|
-
import shutil #
|
|
125
|
+
import shutil,os # These module comes packaged with python
|
|
98
126
|
from android.storage import app_storage_path # type: ignore -- This works only on android
|
|
99
127
|
|
|
100
128
|
app_path = os.path.join(app_storage_path(),'app')
|
|
@@ -103,6 +131,18 @@ image_path= "/storage/emulated/0/Download/profile.png"
|
|
|
103
131
|
shutil.copy(image_path, os.path.join(app_path, "profile.png"))
|
|
104
132
|
```
|
|
105
133
|
|
|
134
|
+
- Avoiding Human Error when using different notification styles
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from android_notify import NotificationStyles
|
|
138
|
+
send_notification(
|
|
139
|
+
title='Picture Alert!',
|
|
140
|
+
message='This notification includes an image.',
|
|
141
|
+
img_path='assets/imgs/icon.png'
|
|
142
|
+
style=NotificationStyles.BIG_PICTURE,
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
106
146
|
---
|
|
107
147
|
|
|
108
148
|
### **Functions Reference**
|
|
@@ -183,6 +223,7 @@ Found a bug? Please open an issue on our [GitHub Issues](https://github.com/Fect
|
|
|
183
223
|
|
|
184
224
|
- Fabian - <fector101@yahoo.com>
|
|
185
225
|
- GitHub: <https://github.com/Fector101/android_notify>
|
|
226
|
+
- Twitter: <https://x.com/CodewithFabian> -- 😊 I'm sure to answer
|
|
186
227
|
|
|
187
228
|
For feedback or contributions, feel free to reach out!
|
|
188
229
|
|
|
@@ -207,4 +248,4 @@ If you find this project helpful, consider buying me a coffee! Your support help
|
|
|
207
248
|
## 🌐 **Links**
|
|
208
249
|
|
|
209
250
|
- **PyPI:** [android-notify on PyPI](https://pypi.org/project/android-notify/)
|
|
210
|
-
- **GitHub:** [Source Code Repository](
|
|
251
|
+
- **GitHub:** [Source Code Repository](https://github.com/Fector101/android_notify/)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
android_notify/__init__.py,sha256=DOUMyhwcXFBbamkxf0fJCBtRemTGXTiJTrQpKV_XF_A,74
|
|
2
|
+
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
android_notify/core.py,sha256=JsfpijK-v4aDDQ0E2ECdzdlGUGlVM51UDCHgLRZFr9w,5916
|
|
4
|
+
android_notify/styles.py,sha256=P_8sAqb3Hbf_vbhqSoCVjKeqJ05Fr_CksO-HX5pj8pU,134
|
|
5
|
+
android_notify-1.21.dist-info/METADATA,sha256=D4DVpiTBOpuMpi0kELE0IGUEX-3-WddoBNJwjn3wsog,5949
|
|
6
|
+
android_notify-1.21.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
7
|
+
android_notify-1.21.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
8
|
+
android_notify-1.21.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
android_notify/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
android_notify/core.py,sha256=P80jtB4Dim9c10ibgVPioEDJOKgjcoetl7rHAHEZEAI,5960
|
|
4
|
-
android_notify/styles.py,sha256=P_8sAqb3Hbf_vbhqSoCVjKeqJ05Fr_CksO-HX5pj8pU,134
|
|
5
|
-
android_notify-1.2.dist-info/METADATA,sha256=pkhzt6TaEZ1gTTEShVpXrATujLqcsVA-GQn3g7X65Qg,5125
|
|
6
|
-
android_notify-1.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
7
|
-
android_notify-1.2.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
8
|
-
android_notify-1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|