android_notify icon indicating copy to clipboard operation
android_notify copied to clipboard

Foreground Service can be simplified more

Open Fector101 opened this issue 3 weeks ago • 2 comments

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

Fector101 avatar Nov 10 '26 14:11 Fector101

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

Fector101 avatar Nov 10 '26 14:11 Fector101

This is the only place the foreground type is interacted with so it's a good feature to have

Fector101 avatar Nov 10 '26 20:11 Fector101