Screen.sleepTimeout not working in android

Hey guys,

In our app, although I am doing:

Screen.sleepTimeout = SleepTimeout.SystemSetting;

it works on iOS and not on Android.

Note:
We have this:

<uses-permission android:name="android.permission.WAKE_LOCK" />

Defined in the manifest.

What might be the issue?

We need to be able to put the app to sleep after a while (according to system settings is perfectly fine but its not working).

I read you need to activate a wake lock and then manually deactivate it after your given time.

According to the docs this should work (its a unity method).

I couldn't get sleepTimeout to do anything either.

1 Answer

1

I found the issue.

We have an android plugin that we don’t use anymore that kept locking the screen from sleeping. Once I got rid of it, the sleep worked out fine.

By the way @meat5000 - according to the docs at this point in time you may only set Screen.sleepTimeout to use systemsettings sleep or neversleep.

OK Cheers!