Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add set type start service (START_STICKY/START_NOT_STICKY/START_RED… #2752

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dvjdjvu
Copy link

@dvjdjvu dvjdjvu commented Feb 17, 2023

I added choice type start service START_STICKY, START_NOT_STICKY and START_REDELIVER_INTENT.
Default use now and before START_NOT_STICKY, but when you close app, service close too.

And I used this code for restart service.

PythonService = autoclass('org.kivy.android.PythonService')
PythonService.mService.setAutoRestartService(True)

Now you can use

PythonService.mService.setTypeStartSticky()
PythonService.mService.setTypeStartNotSticky()
PythonService.mService.setTypeStartRedeliverIntent()

With setTypeStartNotSticky, service doesnt close when app swipping or close.

@dvjdjvu
Copy link
Author

dvjdjvu commented Mar 7, 2023

Hello @misl6, can you look this? I create 2-nd pull request.

@RobertFlatt
Copy link
Contributor

FYI the proposed change is overridden by https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/bootstraps/common/build/templates/Service.tmpl.java#L9-L14 (which also provides service persistence control from buildozer.spec :foreground:sticky).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants