سؤال

I have a scenario that the android device exchanges data with a FTP server via Roaming service. I hope to make OS enter proper sleep mode by setting WakeLock type during the data transferring because it really has no interaction with enduser.

I am going through the sleep threads and trying to verifying that what units will be shut down in sleep mode to prevent data sending. So far, no official doc indicates them .

So , Would you please help to enlighten me on the questions: When Android enters sleep mode , what components will stop working , like WIFI , Data Roaming ?

Thanks a lot.

هل كانت مفيدة؟

المحلول

When Android enters sleep mode, almost everything is shut off. Only basic system apps and GSM/CDMA radios are left on to receive texts, calls, push notifications etc. Services, Activities are all shut off, and the CPU is put into a low power mode. Depending on what the user chose in the wifi settings, the wifi connection may or may not switch to mobile data or shut off completely.

If you want to keep processing, but don't need the screen on to interact with the user, you should acquire a PARTIAL_WAKE_LOCK in which the screen and keyboard are off, but the CPU is kept on. However, remember to release the wake lock when you are done, as PARTIAL_WAKE_LOCK is the only one of the four wake locks in which the CPU will continue to run until you release it or your app is killed. Forgetting to release the wake lock can be a huge drain on the user's battery.

نصائح أخرى

When the power off button (lights off) is pressed by user then phone into sleep mode.

Sleep mode means CPU will be in sleep mode and will accept only command from radio interface layer and alarms. Within fraction of seconds the CPU will go into sleep mode.

When we need only CPU on and other things off we use PARTIAL_WAKE_LOCK which suits perfect in your scenario. Weather this lock is generally used in apps like mp3 player etc.

As you want data transfer here in this mode then you have to override already given methods from class PowerManager with specifically by allowing some function to be turned on in this mode.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top