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

Sticky services #267

Closed
mscansian opened this issue Sep 12, 2014 · 4 comments
Closed

Sticky services #267

mscansian opened this issue Sep 12, 2014 · 4 comments

Comments

@mscansian
Copy link

mscansian commented Sep 12, 2014

Shouldn't the PythonService class be a little bit more flexible? Right now it's only possible to create a foreground service with a notification. If a developer wants, for instance, to create a sticky service without "On going" notifications, it's not possible.

I think it would be nice to change the start_service() in PythonActivity (and of course PythonService) to be able to do this kind of stuff easily.

Have you guys already thought this through?

@tito
Copy link
Member

tito commented Sep 30, 2014

Nop, i guess nobody really go deeply in all android possibilities. It would be a nice addition yep :)

@FeralBytes
Copy link
Contributor

I solved this problem. In your service you just need to put your service in the background; but remember now it can be killed to recliam memory.
Here is the code that goes in your service/main.py:

from jnius import autoclass
Service = autoclass('org.renpy.android.PythonService').mService
Service.stopForeground(True)

Here is the Java Documentation for that call: http://developer.android.com/reference/android/app/Service.html#stopForeground%28boolean%29

@FeralBytes
Copy link
Contributor

@inclement
Copy link
Member

The new p4a toolchain has more flexible service support.

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

No branches or pull requests

4 participants