Android Question Is there any way to keep an app active when device sleeps ?

MitchBu

Well-Known Member
Licensed User
Longtime User
When the user puts the device to sleep with the button, apps stop executing.

Is there any way to keep an app running when the device sleeps ?

TIA
 

JohnC

Expert
Licensed User
Longtime User
Not really.

But depending on what your app needs to do, we might be able to figure out a work-around to solve your situation.

For example, you can setup specific times to wake the device and run your app for a short period of time before the device goes back to sleep.

So, what exactly does your app do and how often does it need to do that?
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
None that are reliable across different models and OS versions.

A niche device, or perhaps if it's rooted, might have a different situation.
 
Upvote 0

MitchBu

Well-Known Member
Licensed User
Longtime User
Oops. Something is missing:


Linking resources Error
c:\android\tools\..\extras\b4a_remote\androidx\core\core\1.7.0\unpacked-core-1.7.0\res\values\values.xml:113: error: resource android:attr/lStar not found.
error: failed linking references.
 
Upvote 0

Spavlyuk

Active Member
Licensed User
What's the value for targetSdkVersion in your manifest? androidx.core:core:1.5.0 and above require targetSdkVersion=30.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…