0

I have found answers to many questions on StackOverflow in the past but this time I'm stumped, so I decided to actually sign up and post my question.

I have developed an app using Android Studio and it works well, however the app just stays on all the time and the device doesn't ever sleep.

I am using the YouTube player API, however this happens even when the video is not playing, which doesn't seem like the right behavior.

I checked the manifests file and these are the only permissions used:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Any ideas what may be causing this? I see people often trying to do the opposite - they want to keep the screen ON.

Thanks in advance

  • See [who is holding a `WakeLock`](http://stackoverflow.com/questions/5780280/how-can-i-see-which-wakelocks-are-active). "even when the video is not playing" -- I haven't used the YouTube player API, but do you mean "when the player is visible but paused or otherwise not playing", "when the player exists but is not visible", or "when the player does not exist"? – CommonsWare Mar 14 '16 at 20:14

1 Answers1

0

Check out the note in the keep screen on section here http://developer.android.com/training/scheduling/wakelock.html there is probably a view in your view hierarchy which requests the screen to be kept on. There is no permission required for that way to keep the screen on.

Remco
  • 129
  • 5