android-notify 1.60.5.dev0__tar.gz → 1.60.6.dev0__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.
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/PKG-INFO +45 -7
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/README.md +44 -6
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/config.py +5 -1
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/sword.py +59 -38
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/PKG-INFO +45 -7
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/pyproject.toml +1 -1
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/__init__.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/__main__.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/an_types.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/an_utils.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/base.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/core.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/fallback-icons/flet-appicon.png +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/fallback-icons/pydroid3-appicon.png +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify/styles.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/SOURCES.txt +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/dependency_links.txt +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/entry_points.txt +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/requires.txt +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/top_level.txt +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/examples/flet-working/src/core.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/examples/flet-working/src/main.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/tests/flet/adv/main.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/tests/flet/adv/tests/__init__.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/tests/flet/adv/tests/test_android_notify_full.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/tests/flet/basic/src/core.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/tests/flet/basic/src/main.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/website/src/pages/data/laner_Sent.py +0 -0
- {android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: android-notify
|
|
3
|
-
Version: 1.60.
|
|
3
|
+
Version: 1.60.6.dev0
|
|
4
4
|
Summary: A Python package that simplifies creating Android notifications in Kivy and Flet apps.
|
|
5
5
|
Author-email: Fabian <fector101@yahoo.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -79,7 +79,7 @@ In your **`buildozer.spec`** file, ensure you include the following:
|
|
|
79
79
|
|
|
80
80
|
```ini
|
|
81
81
|
# Add pyjnius so ensure it's packaged with the build
|
|
82
|
-
requirements = python3, kivy, pyjnius, android-notify
|
|
82
|
+
requirements = python3, kivy, pyjnius, android-notify>=1.60.6.dev0
|
|
83
83
|
# Add permission for notifications
|
|
84
84
|
android.permissions = POST_NOTIFICATIONS
|
|
85
85
|
```
|
|
@@ -91,7 +91,7 @@ In your `pyproject.toml` file, ensure you include the following:
|
|
|
91
91
|
```toml
|
|
92
92
|
[tool.flet.android]
|
|
93
93
|
dependencies = [
|
|
94
|
-
"pyjnius","android-notify
|
|
94
|
+
"pyjnius","android-notify>=1.60.6.dev0"
|
|
95
95
|
]
|
|
96
96
|
|
|
97
97
|
[tool.flet.android.permission]
|
|
@@ -100,7 +100,7 @@ dependencies = [
|
|
|
100
100
|
|
|
101
101
|
### Pydroid 3
|
|
102
102
|
In the [pydroid 3](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3) mobile app for running python code you can test some features.
|
|
103
|
-
- In pip section where you're asked to insert `Libary name` paste `android-notify
|
|
103
|
+
- In pip section where you're asked to insert `Libary name` paste `android-notify>=1.60.6.dev0`
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
### Testing
|
|
@@ -115,14 +115,52 @@ android-notify -v
|
|
|
115
115
|
For Dev Version use
|
|
116
116
|
```requirements = python3, kivy, pyjnius, https://github.com/Fector101/android_notify/archive/without-androidx.zip```
|
|
117
117
|
|
|
118
|
+
### To talk to BroadCast Listener From Buttons
|
|
119
|
+
|
|
120
|
+
- Make things happen without being in your app
|
|
121
|
+
```python
|
|
122
|
+
|
|
123
|
+
from android_notify import Notification
|
|
124
|
+
notification = Notification(title="Reciver Notification")
|
|
125
|
+
notification.addButton(text="Stop", receiver_name="CarouselReceiver", action="ACTION_STOP")
|
|
126
|
+
notification.addButton(text="Skip", receiver_name="CarouselReceiver", action="ACTION_SKIP")
|
|
127
|
+
```
|
|
128
|
+
You can use this [wiki](https://github.com/Fector101/android_notify/wiki/How-to#use-with-broadcast-listener-in-kivy) as a guide create a broadcast listener
|
|
129
|
+
|
|
130
|
+
### To use colored text in your notifications
|
|
118
131
|
|
|
119
|
-
To use colored text in your notifications:
|
|
120
132
|
- Copy the [res](https://github.com/Fector101/android_notify/tree/main/android_notify/res) folder to your app path.
|
|
121
133
|
Lastly in your `buildozer.spec` file
|
|
122
134
|
- Add `source.include_exts = xml` and `android.add_resources = ./res`
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
|
|
137
|
+
### To use Custom Sounds
|
|
138
|
+
|
|
139
|
+
- Put audio files in `res/raw` folder,
|
|
140
|
+
- Then from `buildozer.spec` point to res folder `android.add_resources = res`
|
|
141
|
+
- and includes it's format `source.include_exts = wav`.
|
|
142
|
+
|
|
143
|
+
Lastly From the code
|
|
144
|
+
```py
|
|
145
|
+
# Create a custom notification channel with a unique sound resource for android 8+
|
|
146
|
+
Notification.createChannel(
|
|
147
|
+
id="weird_sound_tester",
|
|
148
|
+
name="Weird Sound Tester",
|
|
149
|
+
description="A test channel used to verify custom notification sounds from the res/raw folder.",
|
|
150
|
+
res_sound_name="sneeze" # file name without .wav or .mp3
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# Send a notification through the created channel
|
|
154
|
+
n=Notification(
|
|
155
|
+
title="Custom Sound Notification",
|
|
156
|
+
message="This tests playback of a custom sound (sneeze.wav) stored in res/raw.",
|
|
157
|
+
channel_id="weird_sound_tester" # important tells notification to use right channel
|
|
158
|
+
)
|
|
159
|
+
n.setSound("sneeze")# for android 7 below
|
|
160
|
+
n.send()
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### For full documentation, examples, and advanced usage, API reference visit the [documentation](https://android-notify.vercel.app)
|
|
126
164
|
|
|
127
165
|
## ☕ Support the Project
|
|
128
166
|
|
|
@@ -56,7 +56,7 @@ In your **`buildozer.spec`** file, ensure you include the following:
|
|
|
56
56
|
|
|
57
57
|
```ini
|
|
58
58
|
# Add pyjnius so ensure it's packaged with the build
|
|
59
|
-
requirements = python3, kivy, pyjnius, android-notify
|
|
59
|
+
requirements = python3, kivy, pyjnius, android-notify>=1.60.6.dev0
|
|
60
60
|
# Add permission for notifications
|
|
61
61
|
android.permissions = POST_NOTIFICATIONS
|
|
62
62
|
```
|
|
@@ -68,7 +68,7 @@ In your `pyproject.toml` file, ensure you include the following:
|
|
|
68
68
|
```toml
|
|
69
69
|
[tool.flet.android]
|
|
70
70
|
dependencies = [
|
|
71
|
-
"pyjnius","android-notify
|
|
71
|
+
"pyjnius","android-notify>=1.60.6.dev0"
|
|
72
72
|
]
|
|
73
73
|
|
|
74
74
|
[tool.flet.android.permission]
|
|
@@ -77,7 +77,7 @@ dependencies = [
|
|
|
77
77
|
|
|
78
78
|
### Pydroid 3
|
|
79
79
|
In the [pydroid 3](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3) mobile app for running python code you can test some features.
|
|
80
|
-
- In pip section where you're asked to insert `Libary name` paste `android-notify
|
|
80
|
+
- In pip section where you're asked to insert `Libary name` paste `android-notify>=1.60.6.dev0`
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
### Testing
|
|
@@ -92,14 +92,52 @@ android-notify -v
|
|
|
92
92
|
For Dev Version use
|
|
93
93
|
```requirements = python3, kivy, pyjnius, https://github.com/Fector101/android_notify/archive/without-androidx.zip```
|
|
94
94
|
|
|
95
|
+
### To talk to BroadCast Listener From Buttons
|
|
96
|
+
|
|
97
|
+
- Make things happen without being in your app
|
|
98
|
+
```python
|
|
99
|
+
|
|
100
|
+
from android_notify import Notification
|
|
101
|
+
notification = Notification(title="Reciver Notification")
|
|
102
|
+
notification.addButton(text="Stop", receiver_name="CarouselReceiver", action="ACTION_STOP")
|
|
103
|
+
notification.addButton(text="Skip", receiver_name="CarouselReceiver", action="ACTION_SKIP")
|
|
104
|
+
```
|
|
105
|
+
You can use this [wiki](https://github.com/Fector101/android_notify/wiki/How-to#use-with-broadcast-listener-in-kivy) as a guide create a broadcast listener
|
|
106
|
+
|
|
107
|
+
### To use colored text in your notifications
|
|
95
108
|
|
|
96
|
-
To use colored text in your notifications:
|
|
97
109
|
- Copy the [res](https://github.com/Fector101/android_notify/tree/main/android_notify/res) folder to your app path.
|
|
98
110
|
Lastly in your `buildozer.spec` file
|
|
99
111
|
- Add `source.include_exts = xml` and `android.add_resources = ./res`
|
|
100
112
|
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
|
|
114
|
+
### To use Custom Sounds
|
|
115
|
+
|
|
116
|
+
- Put audio files in `res/raw` folder,
|
|
117
|
+
- Then from `buildozer.spec` point to res folder `android.add_resources = res`
|
|
118
|
+
- and includes it's format `source.include_exts = wav`.
|
|
119
|
+
|
|
120
|
+
Lastly From the code
|
|
121
|
+
```py
|
|
122
|
+
# Create a custom notification channel with a unique sound resource for android 8+
|
|
123
|
+
Notification.createChannel(
|
|
124
|
+
id="weird_sound_tester",
|
|
125
|
+
name="Weird Sound Tester",
|
|
126
|
+
description="A test channel used to verify custom notification sounds from the res/raw folder.",
|
|
127
|
+
res_sound_name="sneeze" # file name without .wav or .mp3
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
# Send a notification through the created channel
|
|
131
|
+
n=Notification(
|
|
132
|
+
title="Custom Sound Notification",
|
|
133
|
+
message="This tests playback of a custom sound (sneeze.wav) stored in res/raw.",
|
|
134
|
+
channel_id="weird_sound_tester" # important tells notification to use right channel
|
|
135
|
+
)
|
|
136
|
+
n.setSound("sneeze")# for android 7 below
|
|
137
|
+
n.send()
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### For full documentation, examples, and advanced usage, API reference visit the [documentation](https://android-notify.vercel.app)
|
|
103
141
|
|
|
104
142
|
## ☕ Support the Project
|
|
105
143
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os, traceback
|
|
2
2
|
|
|
3
3
|
ON_ANDROID = False
|
|
4
|
-
__version__ = "1.60.
|
|
4
|
+
__version__ = "1.60.6.dev0"
|
|
5
5
|
|
|
6
6
|
def is_platform_android():
|
|
7
7
|
if os.getenv("MAIN_ACTIVITY_HOST_CLASS_NAME"):
|
|
@@ -161,3 +161,7 @@ def app_storage_path():
|
|
|
161
161
|
return kivy_app_storage_path()
|
|
162
162
|
except Exception as e:
|
|
163
163
|
return './' # TODO return file main.py path (not android)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def get_package_name():
|
|
167
|
+
return context.getPackageName() # package.domain + "." + package.name
|
|
@@ -9,7 +9,7 @@ from .an_utils import can_accept_arguments, get_python_activity_context, \
|
|
|
9
9
|
get_bitmap_from_url, add_data_to_intent, get_sound_uri, icon_finder, get_bitmap_from_path, \
|
|
10
10
|
can_show_permission_request_popup, open_settings_screen
|
|
11
11
|
|
|
12
|
-
from .config import from_service_file, get_python_activity, get_notification_manager, ON_ANDROID, on_flet_app
|
|
12
|
+
from .config import from_service_file, get_python_activity, get_notification_manager, ON_ANDROID, on_flet_app, get_package_name
|
|
13
13
|
from .config import (Bundle, String, BuildVersion,
|
|
14
14
|
Intent, PendingIntent,
|
|
15
15
|
app_storage_path,
|
|
@@ -89,7 +89,8 @@ class Notification(BaseNotification):
|
|
|
89
89
|
self.__has_small_icon = False # important notification can't send without
|
|
90
90
|
self.__using_custom = self.message_color or self.title_color
|
|
91
91
|
self.__format_channel(self.channel_name, self.channel_id)
|
|
92
|
-
self.__builder = None #
|
|
92
|
+
self.__builder = None # available through getter `self.builder`
|
|
93
|
+
self.__no_of_buttons = 0
|
|
93
94
|
self.notification_manager = None
|
|
94
95
|
|
|
95
96
|
if not ON_ANDROID:
|
|
@@ -542,52 +543,69 @@ class Notification(BaseNotification):
|
|
|
542
543
|
def builder(self):
|
|
543
544
|
return self.__builder
|
|
544
545
|
|
|
545
|
-
def addButton(self, text: str, on_release):
|
|
546
|
+
def addButton(self, text: str, on_release=None, receiver_name=None, action=None):
|
|
546
547
|
"""For adding action buttons
|
|
547
548
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
549
|
+
:param text: Text For Button
|
|
550
|
+
:param on_release: function to be called when button is clicked
|
|
551
|
+
:param receiver_name: receiver class name
|
|
552
|
+
:param action: action for receiver
|
|
551
553
|
"""
|
|
552
|
-
if self.logs:
|
|
553
|
-
print('Added Button: ', text)
|
|
554
554
|
|
|
555
555
|
if not ON_ANDROID:
|
|
556
|
+
self.__no_of_buttons += 1
|
|
556
557
|
return
|
|
557
558
|
|
|
558
|
-
|
|
559
|
+
# Convert text to CharSequence
|
|
560
|
+
action_text = cast('java.lang.CharSequence', String(text))
|
|
561
|
+
action = action or f"{text}_{self.id}" # tagging with id so it can found notification handle object
|
|
562
|
+
|
|
563
|
+
def set_action(action_intent__):
|
|
564
|
+
action_intent__.setAction(action)
|
|
565
|
+
action_intent__.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
566
|
+
bundle = Bundle()
|
|
567
|
+
bundle.putString("title", self.title or 'Title Placeholder')
|
|
568
|
+
bundle.putInt("key_int", self.__no_of_buttons or 1)
|
|
569
|
+
action_intent__.putExtras(bundle)
|
|
570
|
+
action_intent__.putExtra("button_id", action)
|
|
571
|
+
|
|
572
|
+
def set_default_action_intent():
|
|
573
|
+
action_intent__ = Intent(context, PythonActivity)
|
|
574
|
+
set_action(action_intent__)
|
|
575
|
+
pending_action_intent__ = PendingIntent.getActivity(
|
|
576
|
+
context, self.__no_of_buttons or 1, action_intent__,
|
|
577
|
+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE
|
|
578
|
+
)
|
|
579
|
+
return pending_action_intent__
|
|
580
|
+
|
|
581
|
+
if receiver_name:
|
|
582
|
+
try:
|
|
583
|
+
receiverClass = autoclass(f"{get_package_name()}.{receiver_name}")
|
|
584
|
+
action_intent = Intent(context, receiverClass)
|
|
585
|
+
set_action(action_intent)
|
|
586
|
+
pending_action_intent = PendingIntent.getBroadcast(
|
|
587
|
+
context, self.__no_of_buttons or 1, action_intent,
|
|
588
|
+
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
except Exception as error_getting_broadcast_receiver:
|
|
592
|
+
print("android_notify- error_getting_broadcast_receiver:", error_getting_broadcast_receiver)
|
|
593
|
+
pending_action_intent = set_default_action_intent()
|
|
594
|
+
|
|
595
|
+
else:
|
|
596
|
+
pending_action_intent = set_default_action_intent()
|
|
597
|
+
|
|
559
598
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
action_intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
563
|
-
bundle = Bundle()
|
|
564
|
-
bundle.putString("title", self.title or 'Title Placeholder')
|
|
565
|
-
bundle.putInt("key_int", 68)
|
|
566
|
-
action_intent.putExtras(bundle)
|
|
567
|
-
action_intent.putExtra("button_id", action)
|
|
599
|
+
self.__builder.addAction(int(context.getApplicationInfo().icon), action_text, pending_action_intent)
|
|
600
|
+
self.__builder.setContentIntent(pending_action_intent) # Set content intent for notification tap
|
|
568
601
|
|
|
569
602
|
self.btns_box[action] = on_release
|
|
603
|
+
self.__no_of_buttons += 1
|
|
570
604
|
# action_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
|
571
605
|
|
|
572
606
|
if self.logs:
|
|
607
|
+
print('Added Button: ', text)
|
|
573
608
|
print('Button action: ', action)
|
|
574
|
-
pending_action_intent = PendingIntent.getActivity(
|
|
575
|
-
context,
|
|
576
|
-
0,
|
|
577
|
-
action_intent,
|
|
578
|
-
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE
|
|
579
|
-
)
|
|
580
|
-
# Convert text to CharSequence
|
|
581
|
-
action_text = cast('java.lang.CharSequence', String(text))
|
|
582
|
-
|
|
583
|
-
# Add action with proper types
|
|
584
|
-
self.__builder.addAction(
|
|
585
|
-
int(context.getApplicationInfo().icon), # Cast icon to int
|
|
586
|
-
action_text, # CharSequence text
|
|
587
|
-
pending_action_intent # PendingIntent
|
|
588
|
-
)
|
|
589
|
-
# Set content intent for notification tap
|
|
590
|
-
self.__builder.setContentIntent(pending_action_intent)
|
|
591
609
|
|
|
592
610
|
def removeButtons(self):
|
|
593
611
|
"""Removes all notification buttons
|
|
@@ -1001,7 +1019,7 @@ class NotificationHandler:
|
|
|
1001
1019
|
buttons_object = Notification.btns_box
|
|
1002
1020
|
notifty_functions = Notification.main_functions
|
|
1003
1021
|
if DEV:
|
|
1004
|
-
print("
|
|
1022
|
+
print("notify_functions ", notifty_functions)
|
|
1005
1023
|
print("buttons_object", buttons_object)
|
|
1006
1024
|
try:
|
|
1007
1025
|
action = intent.getAction()
|
|
@@ -1017,7 +1035,10 @@ class NotificationHandler:
|
|
|
1017
1035
|
if action in notifty_functions and notifty_functions[action]:
|
|
1018
1036
|
notifty_functions[action]()
|
|
1019
1037
|
elif action in buttons_object:
|
|
1020
|
-
buttons_object[action]
|
|
1038
|
+
if buttons_object[action]:
|
|
1039
|
+
buttons_object[action]()
|
|
1040
|
+
else:
|
|
1041
|
+
print("android_notify- Notification button function not found got:", buttons_object[action])
|
|
1021
1042
|
except Exception as notification_handler_function_error:
|
|
1022
1043
|
print("Error Type ", notification_handler_function_error)
|
|
1023
1044
|
print('Failed to run function: ', traceback.format_exc())
|
|
@@ -1085,7 +1106,7 @@ class NotificationHandler:
|
|
|
1085
1106
|
permission = Manifest.POST_NOTIFICATIONS
|
|
1086
1107
|
return PackageManager.PERMISSION_GRANTED == context.checkSelfPermission(permission)
|
|
1087
1108
|
else:
|
|
1088
|
-
from android.permissions import Permission, check_permission
|
|
1109
|
+
from android.permissions import Permission, check_permission # type: ignore
|
|
1089
1110
|
return check_permission(Permission.POST_NOTIFICATIONS)
|
|
1090
1111
|
|
|
1091
1112
|
@classmethod
|
|
@@ -1146,7 +1167,7 @@ Opening notification settings...""")
|
|
|
1146
1167
|
context.requestPermissions([permission], 101)
|
|
1147
1168
|
# TODO Callback when user answers request question
|
|
1148
1169
|
else:
|
|
1149
|
-
from android.permissions import request_permissions, Permission
|
|
1170
|
+
from android.permissions import request_permissions, Permission # type: ignore
|
|
1150
1171
|
cls.__requesting_permission = True
|
|
1151
1172
|
request_permissions([Permission.POST_NOTIFICATIONS], on_permissions_result)
|
|
1152
1173
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: android-notify
|
|
3
|
-
Version: 1.60.
|
|
3
|
+
Version: 1.60.6.dev0
|
|
4
4
|
Summary: A Python package that simplifies creating Android notifications in Kivy and Flet apps.
|
|
5
5
|
Author-email: Fabian <fector101@yahoo.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -79,7 +79,7 @@ In your **`buildozer.spec`** file, ensure you include the following:
|
|
|
79
79
|
|
|
80
80
|
```ini
|
|
81
81
|
# Add pyjnius so ensure it's packaged with the build
|
|
82
|
-
requirements = python3, kivy, pyjnius, android-notify
|
|
82
|
+
requirements = python3, kivy, pyjnius, android-notify>=1.60.6.dev0
|
|
83
83
|
# Add permission for notifications
|
|
84
84
|
android.permissions = POST_NOTIFICATIONS
|
|
85
85
|
```
|
|
@@ -91,7 +91,7 @@ In your `pyproject.toml` file, ensure you include the following:
|
|
|
91
91
|
```toml
|
|
92
92
|
[tool.flet.android]
|
|
93
93
|
dependencies = [
|
|
94
|
-
"pyjnius","android-notify
|
|
94
|
+
"pyjnius","android-notify>=1.60.6.dev0"
|
|
95
95
|
]
|
|
96
96
|
|
|
97
97
|
[tool.flet.android.permission]
|
|
@@ -100,7 +100,7 @@ dependencies = [
|
|
|
100
100
|
|
|
101
101
|
### Pydroid 3
|
|
102
102
|
In the [pydroid 3](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3) mobile app for running python code you can test some features.
|
|
103
|
-
- In pip section where you're asked to insert `Libary name` paste `android-notify
|
|
103
|
+
- In pip section where you're asked to insert `Libary name` paste `android-notify>=1.60.6.dev0`
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
### Testing
|
|
@@ -115,14 +115,52 @@ android-notify -v
|
|
|
115
115
|
For Dev Version use
|
|
116
116
|
```requirements = python3, kivy, pyjnius, https://github.com/Fector101/android_notify/archive/without-androidx.zip```
|
|
117
117
|
|
|
118
|
+
### To talk to BroadCast Listener From Buttons
|
|
119
|
+
|
|
120
|
+
- Make things happen without being in your app
|
|
121
|
+
```python
|
|
122
|
+
|
|
123
|
+
from android_notify import Notification
|
|
124
|
+
notification = Notification(title="Reciver Notification")
|
|
125
|
+
notification.addButton(text="Stop", receiver_name="CarouselReceiver", action="ACTION_STOP")
|
|
126
|
+
notification.addButton(text="Skip", receiver_name="CarouselReceiver", action="ACTION_SKIP")
|
|
127
|
+
```
|
|
128
|
+
You can use this [wiki](https://github.com/Fector101/android_notify/wiki/How-to#use-with-broadcast-listener-in-kivy) as a guide create a broadcast listener
|
|
129
|
+
|
|
130
|
+
### To use colored text in your notifications
|
|
118
131
|
|
|
119
|
-
To use colored text in your notifications:
|
|
120
132
|
- Copy the [res](https://github.com/Fector101/android_notify/tree/main/android_notify/res) folder to your app path.
|
|
121
133
|
Lastly in your `buildozer.spec` file
|
|
122
134
|
- Add `source.include_exts = xml` and `android.add_resources = ./res`
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
|
|
137
|
+
### To use Custom Sounds
|
|
138
|
+
|
|
139
|
+
- Put audio files in `res/raw` folder,
|
|
140
|
+
- Then from `buildozer.spec` point to res folder `android.add_resources = res`
|
|
141
|
+
- and includes it's format `source.include_exts = wav`.
|
|
142
|
+
|
|
143
|
+
Lastly From the code
|
|
144
|
+
```py
|
|
145
|
+
# Create a custom notification channel with a unique sound resource for android 8+
|
|
146
|
+
Notification.createChannel(
|
|
147
|
+
id="weird_sound_tester",
|
|
148
|
+
name="Weird Sound Tester",
|
|
149
|
+
description="A test channel used to verify custom notification sounds from the res/raw folder.",
|
|
150
|
+
res_sound_name="sneeze" # file name without .wav or .mp3
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# Send a notification through the created channel
|
|
154
|
+
n=Notification(
|
|
155
|
+
title="Custom Sound Notification",
|
|
156
|
+
message="This tests playback of a custom sound (sneeze.wav) stored in res/raw.",
|
|
157
|
+
channel_id="weird_sound_tester" # important tells notification to use right channel
|
|
158
|
+
)
|
|
159
|
+
n.setSound("sneeze")# for android 7 below
|
|
160
|
+
n.send()
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### For full documentation, examples, and advanced usage, API reference visit the [documentation](https://android-notify.vercel.app)
|
|
126
164
|
|
|
127
165
|
## ☕ Support the Project
|
|
128
166
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "android-notify"
|
|
7
|
-
version = "1.60.
|
|
7
|
+
version = "1.60.6.dev0"
|
|
8
8
|
description = "A Python package that simplifies creating Android notifications in Kivy and Flet apps."
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
authors = [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/requires.txt
RENAMED
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/android_notify.egg-info/top_level.txt
RENAMED
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/examples/flet-working/src/core.py
RENAMED
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/examples/flet-working/src/main.py
RENAMED
|
File without changes
|
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/tests/flet/adv/tests/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_notify-1.60.5.dev0 → android_notify-1.60.6.dev0}/docs/website/src/pages/data/laner_Sent.py
RENAMED
|
File without changes
|
|
File without changes
|