Any ideas let toga android run in backgroud? #1679
Answered
by
mhsmith
ThinkNaive
asked this question in
Q&A
-
I wrote a tiny app downloading files. Every time the screen off, the app stops downloading (may be hang by system strategy). Are there any approaches (e.g. wake lock or play silent sound) can let it run in background? Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
mhsmith
Nov 13, 2022
Replies: 1 comment
-
You shold be able to use a wake lock, like this. Notes on converting the code to Python:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ThinkNaive
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You shold be able to use a wake lock, like this. Notes on converting the code to Python:
self
is yourApp
object, then theContext
on which to callgetSystemService
isself._impl.native
.POWER_SERVICE
can also be obtained as an attribute of theContext
.PowerManager
can be imported usingfrom ... import ...
syntax, as shown here.