Alexander
Alexander

Reputation: 11

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 ?

Upvotes: 1

Views: 2553

Answers (1)

Blitz
Blitz

Reputation: 186

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.

Upvotes: 1

Related Questions