android_notify
android_notify copied to clipboard
Foreground Service can be simplified more
In n.start_foreground(type=) handles service lookup, type int, API level checks
purposed change:
# service.py
from android_notify import Notification
n = Notification(title="Syncing", message="Starting...", channel_id="sync", channel_name="Sync")
n.start_foreground(type=)
# normal update methods keep working
n.updateMessage("Uploaded 3/10 files")
then simplify: https://android-notify.vercel.app/foreground-services#running-the-service
Note to self i also have to commodate services with multiple types, available since Android 10 (API 29).
maybe type can be str or list
n.start_foreground(
type=["location", "dataSync"]
) # bitwise-OR internally
PLUS the issue of parsing string to find their actual types
BUT this will be more easier for users so they only have to remember the type name they stated in the buildozer file
This is the only place the foreground type is interacted with so it's a good feature to have