plateaukao / AutoScreenOnOff

an android utility app to turn on/off screen automatically by s/w instead of h/w power button
55 stars 21 forks source link

Fail disable while sleep #1

Open ntvsx193 opened 10 years ago

ntvsx193 commented 10 years ago

I have set time sleep start time - 01:00 AM sleep end time - 08:00 AM

Current time will be 22:18 (10:18 PM) - app be sleep! If i set start time more AM, end more PM - app correct running.

ntvsx193 commented 10 years ago

screenshot_2013-10-20-22-22-44

plateaukao commented 10 years ago

I will check this issue recently. Could you let me know which version did you use?

luciferz2012 commented 10 years ago
    @Override
    public void onDestroy() {
        CV.logi("onDestroy");
        // if (mIsRegistered)
        // unregisterSensor();
        super.onDestroy();
    }

Comment unregisterSensor in onDestroy function in SensorMonitorService.java and the SLEEP mode works fine for me.

It seems that once the app activates the SLEEP option, it restarts the service by calling unregisterSensor and registerSensor. And in the unregisterSensor function the app will call stopSelf to invoke onDestroy.

However, the onDestroy function is executed after (NOT BEFORE, it is strange...) registerSensor, so the unregisterSensor in the onDestroy function will be called again.

PeterDaveHello commented 9 years ago

+1, latest version on google play

plateaukao commented 9 years ago

Thanks a lot~ I will try to add this modification and see how it goes. :D