简体   繁体   中英

Make app/service “run after screen turns off” ? -Android-

i a'm completly android programing noob

i'am working on developing "Androrat" (this project is not mine i had found it over the internet)

when the screen turns off the connection is lost how can i make the processes/service always running ?

I had googled some and found that i have to include a partial_wake_timer I want the code and where i have to enter it ?

I a'm completely noob please bair with me

http://dl.dropbox.com/u/102520949/Untitled.jpg

or maybe a kind person can help me over team-viewer ?

A partial WakeLock is what you want. It will hold the CPU open, even if the screen is off.

To acquire:

PowerManager mgr = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock");
wakeLock.acquire();

To release:

wakeLock.release();

This answer was taken from this link: How can I keep my Android service running when the screen is turned off?

Next time, please search more deeply.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM