Search Unity

Trouble adding wake_lock permission in AndroidManifest.xml.

Discussion in 'Android' started by ManieBesselaar, Jan 28, 2020.

  1. ManieBesselaar

    ManieBesselaar

    Joined:
    Nov 1, 2018
    Posts:
    30
    Hi there
    This is my first time asking on this forum, so please forgive me if I make a mistake (wrong etiquette, wrong forum etc)

    My game keeps going to sleep on android.

    I have added
    Code (CSharp):
    1.  
    2.  Screen.sleepTimeout =SleepTimeout.NeverSleep;
    3.  
    4. ;
    To the start of a singleton class which gets instantiated at the load of my splash screen.

    As I understand it this should keep the screen on , but it does not work .

    I understand that the wake_lock permission needs to be added to the AndroidManifest.xml file.

    I cannot seem to find it in my project folder.

    I even tried creating a folder .../assets/plugins/android/ and placing the partial android manifest there but this simply causes gradle to fail my build.

    I removed the file before copying the error, but I can recreate the error if need be .

    Any guidance here will be greatly appreciated.
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836
    Hi, no permissions are needed for this to work. Make sure the code is actually executed. Output some text to the console before setting Screen.sleepTimeout and check the console to see if that code was executed.