Hi,

I'm developing a backup service that contact with another through
network.
There are wake lock held and released iteratively for the whole
transmission but the process is always killed by system because of
"Excessively wake lock ...".
This is my code snippet for the problem.

    private void acquireWakeLock()
    {
       if (mPMWakeLock == null)
        {
             Logger.d("acquireWakeLock");
            PowerManager pm =
(PowerManager)application.getSystemService(Context.POWER_SERVICE);
            mPMWakeLock =
pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
this.getClass().getName());
            mPMWakeLock.acquire();
        }
    }
    private void releaseWakeLock()
    {
       if (mPMWakeLock != null && mPMWakeLock.isHeld())
        {
            Logger.d("releaseWakeLock");
            mPMWakeLock.release();
            mPMWakeLock = null;
        }
    }
:
:
:

private void doContact(final T... list) {
                new Thread(new Runnable() {
                @Override
                public void run() {
:
:
                while(get(0) != null) {
                if (NetworkUtils.isConnected(application)) {
                acquireWakeLock();
:
:
                releaseWakeLock();
                                        }
:
:
                                        }

Could you please help to let me know what is the wake lock policy in
2.3?
Thank you!

Regards,
Kooshi

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to