Domanda

I have a single started service in my application which keeps my application alive. I am downloading the data in a thread in my application(may take from 1 minute from 30 minute). I want my application not to go in sleep state. I dont want to use the PARTIAL_WAKELOCK mechanism to keep the battery life long.

Here, The intention of having some PARTIAL_WAKELOCK like functionality not because of the service, 
I want it just for few threads(tasks).

Can AlarmManager help?

È stato utile?

Soluzione

I want my application not to go in sleep state.

Then use a WakeLock.

I dont want to use the PARTIAL_WAKELOCK mechanism to keep the battery life long.

You do not have a choice.

Here, The intention of having some PARTIAL_WAKELOCK like functionality not because of the service, I want it just for few threads(tasks).

A WakeLock does not affect a service. It does not affect a "few threads". It affects the device's CPU. The CPU is what goes to sleep, not your service, and not your threads. If you do not want the CPU to go to sleep, you must use a WakeLock.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top